From 5b1c0c077ba801089eab0d2e800ec5e980de31ef Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 17 Sep 2019 15:59:38 +0200 Subject: [PATCH] More meaningful graph --- r/thunder_configure.R | 50 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/r/thunder_configure.R b/r/thunder_configure.R index 146c327..33b649c 100644 --- a/r/thunder_configure.R +++ b/r/thunder_configure.R @@ -148,7 +148,7 @@ v8 <- ggplot(data=latency_evol, aes(x=ident,y=lat_ms)) + theme_classic() thunder_drop <- read.csv("thunder_configure_16_drop.csv") -thunder_drop_2 <- sqldf("select run, packet_range, 1.0*count / 990 as packet_ratio, row_number() OVER (partition by packet_range order by run) sorting from thunder_drop where run LIKE '%-24' ") +thunder_drop_2 <- sqldf("select run, packet_range, 1.0*count / 990 as packet_ratio, row_number() OVER (partition by packet_range order by run) sorting from thunder_drop where run LIKE '%-26' ") #cats <- c("0-989","990-1979","1980-2969","2970-3959","3960-4949","4950-5939","5940-6929","6930-7919","7920-8909","8910-9899") thunder_drop_2$packet_range <- as.factor(thunder_drop_2$packet_range) thunder_drop_2$sorting <- as.factor(thunder_drop_2$sorting) @@ -171,28 +171,62 @@ v9 <- ggplot(data = thunder_drop_2, aes(x=packet_range, y=packet_ratio,fill=sort thunder_drop_burst <- read.csv("thunder_configure_16_drop_burst.csv") tdb_ag <- sqldf("select run,count,COUNT(count) as oc from thunder_drop_burst where run LIKE '%-24' group by run,count") -tdb_ag_2 <- sqldf("select run,count,oc,row_number() OVER (partition by count order by run) as sorting from tdb_ag") +tdb_ag_2 <- sqldf( +" +select + td.run as r, + count, + oc, + total, + 1.0 * oc / total as oc_ratio, + row_number() OVER (partition by count order by td.run) as sorting +from + tdb_ag as td, + (select run,SUM(oc) as total from tdb_ag group by run) as ag +where + td.run = ag.run +") + tdb_ag_2$sorting <- as.factor(tdb_ag_2$sorting) tdb_ag_2$count <- as.factor(tdb_ag_2$count) -v10 <- ggplot(data = tdb_ag_2, aes(x=count, y=oc)) + +v10 <- ggplot(data = tdb_ag_2, aes(x=count, y=oc_ratio)) + #geom_bar(stat="summary",position = "dodge") + #scale_y_log10() + geom_violin(scale='width') + geom_boxplot(width=0.1, outlier.shape=NA) + - scale_y_continuous() + - ylab("Occurence") + - xlab("Packets dropped in a row") + + scale_y_continuous(labels = scales::percent) + + ylab("% observed drops") + + xlab("Packets lost during the drop") + scale_fill_grey() + theme_classic() thunder_red <- read.csv("thunder_configure_16_red.csv") -tred <- sqldf("select run,delivered_at_once,occur,row_number() OVER (partition by delivered_at_once order by run) as sorting from thunder_red WHERE run LIKE '%-24'") +tred <- sqldf( +" +select + tr.run as r, + delivered_at_once, + 1.0 * occur / total as occur_ratio, + occur, + total, + row_number() OVER (partition by delivered_at_once order by tr.run) as sorting +from + thunder_red tr, + (select run,SUM(occur) as total from thunder_red group by run) as ag +WHERE + tr.run LIKE '%-26' + and tr.run = ag.run + +") tred$sorting <- as.factor(tred$sorting) tred$delivered_at_once <- as.factor(tred$delivered_at_once) -v11 <- ggplot(data = tred, aes(x=delivered_at_once, y=occur)) + +v11 <- ggplot(data = tred, aes(x=delivered_at_once, y=occur_ratio)) + #geom_bar(stat="summary",position = "dodge") + geom_violin(scale='width') + + xlab('Fresh packets per cell') + + ylab('% of received cells') + + scale_y_continuous(labels = scales::percent) + geom_boxplot(width=0.1, outlier.shape=NA) + theme_classic()