From f20cfc990dea7d67876353ffc80ec8cfb009eb8c Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 16 Sep 2019 19:20:38 +0200 Subject: [PATCH] WIP links graph --- r/thunder_configure.R | 14 ++++++++++++++ scripts/links_parse.py | 28 ++++++++++++++++++++++++++-- scripts/parse_lib.sh | 4 ++-- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/r/thunder_configure.R b/r/thunder_configure.R index 0e42681..7c64643 100644 --- a/r/thunder_configure.R +++ b/r/thunder_configure.R @@ -52,3 +52,17 @@ 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") +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() + diff --git a/scripts/links_parse.py b/scripts/links_parse.py index 93ac20c..58a5865 100755 --- a/scripts/links_parse.py +++ b/scripts/links_parse.py @@ -2,11 +2,35 @@ import sys,re +acc = [] +previous=None for line in sys.stdin: res = re.match(r"\[(\d+)\] Blacklisted links: ([_U]+)", line) if not res: continue ts,l = res.groups() + ts = int(ts) l2 = [(i, 'up' if l[i] == "U" else 'down') for i in range(len(l))] - for i,v in l2: - print(f"{sys.argv[1]},{ts},{i},{v}") + acc.append((ts,l2)) + +l2 = None +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] + +for j in range(len(acc)): + ts, l = acc[j] + + ts_next, l_next = acc[j] + if j+1 < len(acc): ts_next, l_next = acc[j+1] + + delta = ts_next - ts + 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}") + if will_change: durations[i] = 0 diff --git a/scripts/parse_lib.sh b/scripts/parse_lib.sh index 531f54c..369deff 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" + echo "run,ts,link_id,status,delta,duration,will_change,xp_time" get_xp $1 | while read r; do for i in $(seq 0 1 $2); do - grep -q 'thunder-server 8' out/$r-$i/info.txt && cat out/$r-$i/log/client-donar-stdout.log | ./links_parse.py $r-$i + 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 done done }