tor_multipath_voip/r/thunder_configure.R

69 lines
2.8 KiB
R
Raw Normal View History

2019-09-14 14:26:57 +00:00
library(ggplot2)
library(sqldf)
library(plyr)
library(cowplot)
2019-09-16 16:00:15 +00:00
thunder_ms <- read.csv("thunder_configure_12.csv")
2019-09-14 17:15:22 +00:00
thunder_ms <- sqldf("select run,jmax,links,latency, CAST(latency as real) / 1000. as lat_ms from thunder_ms")
thunder_ms$links <- as.factor(thunder_ms$links)
thunder_ms$jmax <- as.factor(thunder_ms$jmax)
v1 <- ggplot(data = thunder_ms, aes(x = jmax, y=lat_ms, fill=links)) +
2019-09-15 13:31:10 +00:00
geom_boxplot() +
2019-09-16 16:00:15 +00:00
geom_hline(yintercept=800, color = "red", linetype="dashed") +
geom_hline(yintercept=400, color = "DarkGreen") +
annotate("text", x=8, y=550, label= "high", color="DarkGreen") +
annotate("text", x=7.7, y=1000, label= "acceptable", color="red") +
coord_cartesian(xlim = c(1, 8)) +
2019-09-14 17:15:22 +00:00
scale_fill_grey() +
2019-09-16 16:00:15 +00:00
scale_y_log10() +
2019-09-14 17:15:22 +00:00
ylab("latency (ms)") +
xlab("max allowed jitter") +
theme_classic()
2019-09-16 16:00:15 +00:00
#v1 + ggsave("thunder_configure_ms.png", dpi=300, dev='png', height=5, width=15, units="cm")
2019-09-14 17:15:22 +00:00
2019-09-16 14:37:38 +00:00
thunder_rcv <- sqldf("select run,jmax,links,(9900-COUNT(latency)*1.0)/9900 as dlv from thunder_ms group by jmax,links,run")
2019-09-16 07:56:34 +00:00
thunder_rcv$jmax <- as.factor(thunder_rcv$jmax)
thunder_rcv$links <- as.factor(thunder_rcv$links)
v2 <- ggplot(data = thunder_rcv, aes(x = jmax, y=dlv, fill=links)) +
geom_boxplot() +
scale_y_continuous(labels = scales::percent) +
scale_fill_grey() +
ylab("dropped packets") +
xlab("max allowed jitter") +
theme_classic()
2019-09-16 16:00:15 +00:00
thunder_bw <- read.csv("thunder_configure_12_bw.csv")
2019-09-16 07:56:34 +00:00
thunder_bw <- sqldf("select run,jmax,links,udp_sent,udp_rcv,cells_sent,cells_rcv,1.0*cells_sent/udp_sent as sent_ratio,1.0*cells_rcv/udp_rcv as rcv_ratio from thunder_bw where udp_sent > 4000")
thunder_bw$jmax <- as.factor(thunder_bw$jmax)
thunder_bw$links <- as.factor(thunder_bw$links)
v3 <- ggplot(data = thunder_bw, aes(x = jmax, y=sent_ratio, fill=links)) +
geom_boxplot() +
2019-09-16 12:40:58 +00:00
#scale_y_log10() +
2019-09-16 07:56:34 +00:00
#scale_y_log10(labels = scales::percent) +
scale_fill_grey() +
ylab("bandwidth ratio") +
xlab("max allowed jitter") +
theme_classic()
t1 <- plot_grid(v1, v2, v3, labels = c('A', 'B', 'C'), ncol=1)
t1 + ggsave("thunder_configure.png", dpi=300, dev='png', height=15, width=15, units="cm")
2019-09-16 17:20:38 +00:00
thunder_links <- read.csv("thunder_configure_12_links.csv")
links_down_at_least_once <- sqldf("select run,xp_time,link_id, COUNT(status) as downcount, SUM(delta) as elapsed from thunder_links where status='down' group by run,link_id,xp_time")
links_down_at_least_once2 <- sqldf("select row_number () OVER (PARTITION BY run ORDER BY elapsed DESC) sorting,run,link_id,downcount,elapsed,xp_time,1.0*elapsed/xp_time down_ratio from links_down_at_least_once")
links_down_at_least_once2$sorting <- as.factor(links_down_at_least_once2$sorting)
ggplot(data = links_down_at_least_once2, aes(x = sorting, y=down_ratio)) +
geom_boxplot() +
#scale_y_log10() +
scale_y_log10(labels = scales::percent) +
scale_fill_grey() +
ylab("down ratio") +
xlab("sorting") +
theme_classic()