From 0c959ac6b6f51ccba6add2b402e4824519816938 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 17 Sep 2019 23:05:52 +0200 Subject: [PATCH] WIP my graph --- r/thunder_configure.R | 168 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 155 insertions(+), 13 deletions(-) diff --git a/r/thunder_configure.R b/r/thunder_configure.R index 37c7f25..3076d2a 100644 --- a/r/thunder_configure.R +++ b/r/thunder_configure.R @@ -236,10 +236,19 @@ t3 <- plot_grid(v8, v9, v10, v11, labels = c('A', 'B', 'C', 'D'), ncol=2) t3 + ggsave("thunder_packets.png", dpi=300, dev='png', height=12, width=15, units="cm") tor_multi_lat <- read.csv("tor_just_many_latencies.csv") -tor_drop <- sqldf("select run,conf,1.0*MAX(ident)/33 as last_one from tor_multi_lat group by run,conf") -v12 <- ggplot(data=tor_drop,aes(x=last_one)) + +tor_multi_lat_100 <- read.csv("tor_just_many_latencies_100.csv") + +tor_drop <- sqldf( +" +select run,conf,1.0*MAX(ident)/33 as last_one,'33' as pkt_sec from tor_multi_lat group by run,conf +union +select run,conf,1.0*MAX(ident)/10 as last_one, '10' as pkt_sec from tor_multi_lat_100 group by run,conf +") + +v12 <- ggplot(data=tor_drop,aes(x=last_one, linetype=factor(pkt_sec, levels=c('33', '10')))) + stat_ecdf(pad = FALSE) + ylab("% broken links") + + labs(linetype="Pkt/sec") + coord_cartesian(xlim = c(0, 300), ylim = c(0,0.5)) + scale_y_continuous(labels = scales::percent) + xlab("Elapsed time (sec)") + @@ -252,22 +261,155 @@ library(purrr) library(tidyr) tor_lat_stack <- tor_multi_lat %>% - + dplyr::mutate(latency = latency / 1000) %>% dplyr::group_by(run,conf) %>% dplyr::summarise( id = paste(first(run),first(conf)), min = min(latency), - max = max(latency), + q25 = quantile(latency,0.25) - min(latency), + median = median(latency) - quantile(latency,0.25), + q75 = quantile(latency,0.75) - median(latency), + q95 = quantile(latency,0.95) - quantile(latency,0.75), + q99 = quantile(latency,0.99) - quantile(latency,0.95), + max = max(latency) - quantile(latency,0.99), max_sort = max(latency), - q25 = quantile(latency,0.25), - median = median(latency), - median_sort = median(latency), - q75 = quantile(latency,0.75), - q95 = quantile(latency,0.95), - q99 = quantile(latency,0.99) + median_sort = median(latency) ) tor_lat_stack <- gather(tor_lat_stack, 'min', 'max', 'q25', 'median', 'q75', 'q95', 'q99', key="quantile_name", value="quantile_value") -ggplot(tor_lat_stack, aes(x=id,y=quantile_value,fill=quantile_name)) + - ylim(0,1000000) + - geom_bar(stat="identity", position="dodge") +v13 <- ggplot(tor_lat_stack, aes( + x=reorder(id,median_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm")) + +v14 <- ggplot(tor_lat_stack, aes( + x=reorder(id,median_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + #coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(),axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm")) + +v15 <- ggplot(tor_lat_stack, aes( + x=reorder(id,max_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"), plot.tag.position='top') + +v16 <- ggplot(tor_lat_stack, aes( + x=reorder(id,max_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + #coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"),plot.tag.position='bottom') + +t4 <- plot_grid(v16, v15, v14, v13, labels = c('A', 'B', 'C', 'D'), ncol=1) +t4 + ggsave("tor_30ms.png", dpi=300, dev='png', height=20, width=15, units="cm") + + +tor_lat_stack_100 <- tor_multi_lat_100 %>% + dplyr::mutate(latency = latency / 1000) %>% + dplyr::group_by(run,conf) %>% + dplyr::summarise( + id = paste(first(run),first(conf)), + min = min(latency), + q25 = quantile(latency,0.25) - min(latency), + median = median(latency) - quantile(latency,0.25), + q75 = quantile(latency,0.75) - median(latency), + q95 = quantile(latency,0.95) - quantile(latency,0.75), + q99 = quantile(latency,0.99) - quantile(latency,0.95), + max = max(latency) - quantile(latency,0.99), + max_sort = max(latency), + median_sort = median(latency) + ) + +tor_lat_stack_100 <- gather(tor_lat_stack_100, 'min', 'max', 'q25', 'median', 'q75', 'q95', 'q99', key="quantile_name", value="quantile_value") +v17 <- ggplot(tor_lat_stack_100, aes( + x=reorder(id,median_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm")) + +v18 <- ggplot(tor_lat_stack_100, aes( + x=reorder(id,median_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + #coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(),axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm")) + +v19 <- ggplot(tor_lat_stack_100, aes( + x=reorder(id,max_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"), plot.tag.position='top') + +v20 <- ggplot(tor_lat_stack_100, aes( + x=reorder(id,max_sort), + y=quantile_value, + fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min'))) +) + + #coord_cartesian(ylim = c(0,1500)) + + labs(fill="quantile")+ + xlab("Tor circuits") + + ylab("RTT (ms)") + + geom_bar(stat="identity", position="stack",width=1) + + scale_fill_grey() + + theme_classic() + + theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"),plot.tag.position='bottom') + +t5 <- plot_grid(v20, v19, v18, v17, labels = c('A', 'B', 'C', 'D'), ncol=1) +t5 + ggsave("tor_100ms.png", dpi=300, dev='png', height=20, width=15, units="cm") +