From f4e41c447779349669bdec80cecf5d7be3c3c013 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 16 Sep 2019 22:53:34 +0200 Subject: [PATCH] WIP graph --- r/thunder_configure.R | 63 ++++++++++++++++++++++++++++++++++++------ scripts/links_parse.py | 9 +++++- scripts/parse_lib.sh | 4 +-- 3 files changed, 65 insertions(+), 11 deletions(-) diff --git a/r/thunder_configure.R b/r/thunder_configure.R index 7c64643..1ac57c7 100644 --- a/r/thunder_configure.R +++ b/r/thunder_configure.R @@ -3,21 +3,21 @@ library(sqldf) library(plyr) library(cowplot) -thunder_ms <- read.csv("thunder_configure_12.csv") +thunder_ms <- read.csv("thunder_configure_13.csv") 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)) + - geom_boxplot() + + geom_violin() + 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)) + scale_fill_grey() + - scale_y_log10() + + #scale_y_log10() + ylab("latency (ms)") + xlab("max allowed jitter") + theme_classic() @@ -35,7 +35,7 @@ v2 <- ggplot(data = thunder_rcv, aes(x = jmax, y=dlv, fill=links)) + xlab("max allowed jitter") + theme_classic() -thunder_bw <- read.csv("thunder_configure_12_bw.csv") +thunder_bw <- read.csv("thunder_configure_13_bw.csv") 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) @@ -53,16 +53,63 @@ v3 <- ggplot(data = thunder_bw, aes(x = jmax, y=sent_ratio, fill=links)) + 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") -thunder_links <- read.csv("thunder_configure_12_links.csv") +thunder_links <- read.csv("thunder_configure_13_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() + +v4 <- ggplot(data = links_down_at_least_once2, aes(x = sorting, y=down_ratio)) + + #geom_violin() + + #geom_boxplot(width=0.2) + #scale_y_log10() + - scale_y_log10(labels = scales::percent) + + #scale_y_log10(labels = scales::percent) + + geom_bar(stat="summary") + + #scale_y_log10() + + scale_y_continuous(labels = scales::percent) + scale_fill_grey() + ylab("down ratio") + xlab("sorting") + theme_classic() +downtime <- sqldf( +" +select sorting,1.0*duration/1000 as dur +from thunder_links as tl +inner join links_down_at_least_once2 as l2 on + tl.run = l2.run + and tl.link_id = l2.link_id +where will_change='True' + and status='down'") + +v5 <- ggplot(data = downtime, aes(x=sorting, y=dur)) + + geom_violin() + + scale_y_log10() + + theme_classic() + +gobal_links <- sqldf( +" +select ts,run,durations_global,8-COUNT(status) as down_link_count,xp_time +from thunder_links +where will_change_global='True' and status='up' and durations_global > 0 +group by ts,run,durations_global +") + +down_group_ratio <- sqldf( +" +select run,1.0 * SUM(durations_global)/xp_time as down_ratio, down_link_count +from gobal_links +where down_link_count >= 0 +group by run,down_link_count,xp_time +") + +down_group_ratio$down_link_count <- as.factor(down_group_ratio$down_link_count) +v6 <- ggplot(data = down_group_ratio, aes(x=down_link_count, y=down_ratio)) + + geom_bar(stat="summary") + + #scale_y_log10() + + scale_y_continuous(labels = scales::percent) + + theme_classic() + + +t2 <- plot_grid(v4, v5, v6, labels = c('A', 'B', 'C'), ncol=1) + + + diff --git a/scripts/links_parse.py b/scripts/links_parse.py index 58a5865..801a64c 100755 --- a/scripts/links_parse.py +++ b/scripts/links_parse.py @@ -18,7 +18,9 @@ if len(acc) <= 0: sys.exit(0) ts_first, l_first = acc[0] ts_last, l_last = acc[len(acc) - 1] xp_time = ts_last - ts_first + durations = [0 for i,v in l_first] +durations_link_config = 0 for j in range(len(acc)): ts, l = acc[j] @@ -27,10 +29,15 @@ for j in range(len(acc)): if j+1 < len(acc): ts_next, l_next = acc[j+1] delta = ts_next - ts + + durations_link_config += delta + will_change_duration = l != l_next + for i,v in l: durations[i] += delta i_next,v_next = l_next[i] will_change = v != v_next or j+1 == len(acc) - print(f"{sys.argv[1]},{ts},{i},{v},{delta},{durations[i]},{will_change},{xp_time}") + print(f"{sys.argv[1]},{ts},{i},{v},{delta},{durations[i]},{will_change},{xp_time},{durations_link_config},{will_change_duration}") if will_change: durations[i] = 0 + if will_change_duration: durations_link_config = 0 diff --git a/scripts/parse_lib.sh b/scripts/parse_lib.sh index 369deff..cc151bd 100644 --- a/scripts/parse_lib.sh +++ b/scripts/parse_lib.sh @@ -51,10 +51,10 @@ parse_thunder_bw() { } parse_thunder_links() { - echo "run,ts,link_id,status,delta,duration,will_change,xp_time" + echo "run,ts,link_id,status,delta,duration,will_change,xp_time,durations_global,will_change_global" get_xp $1 | while read r; do for i in $(seq 0 1 $2); do - grep -q 'thunder-client 9900 30 100 8 150' out/$r-$i/info.txt && cat out/$r-$i/log/client-donar-stdout.log | ./links_parse.py $r-$i || true + grep -q 'thunder-client 9900 30 100 8 250' out/$r-$i/info.txt && cat out/$r-$i/log/client-donar-stdout.log | ./links_parse.py $r-$i || true done done }