Add scripts

This commit is contained in:
Quentin 2019-10-31 18:05:47 +01:00
parent 966fd2008f
commit aceee0157d
4 changed files with 68 additions and 2 deletions

29
r/config_light.R Normal file
View file

@ -0,0 +1,29 @@
library(ggplot2)
library(sqldf)
library(plyr)
library(dplyr)
d <- read.csv("../../donar-res/tmp_light/boxplot1.csv")
d$strat <- as.factor(d$strat)
d$window <- as.factor(d$window)
#d$decile <- factor(d$decile, levels = c("MIN", "D0.1", "D1", "D25", "D50", "D75", "D99", "D99.9"))
d$decile <-factor(d$decile,levels=c("MAX", "D99.9", "D99", "D75", "D50", "D25", "D1", "D0.1", "MIN"))
d <- d %>% mutate (lat = latency / 1000)
ggplot(sqldf("select * from d where decile != 'MAX'") %>% arrange(decile), aes(x=strat:window,y=lat,group=decile,fill=decile)) +
geom_bar(stat='identity', position='identity') +
scale_fill_grey() +
geom_hline(yintercept = 200) +
geom_hline(yintercept = 400) +
theme_classic()
e <- read.csv("../../donar-res/tmp_light/boxplot2.csv")
e$strat <- as.factor(e$strat)
e$links <- as.factor(e$links)
e$decile <-factor(e$decile,levels=c("MAX", "D99.9", "D99", "D75", "D50", "D25", "D1", "D0.1", "MIN"))
e <- e %>% mutate (lat = latency / 1000)
ggplot(sqldf("select * from e where decile != 'MAX'") %>% arrange(decile), aes(x=strat:links,y=lat,group=decile,fill=decile)) +
geom_bar(stat='identity', position='identity') +
scale_fill_grey() +
geom_hline(yintercept = 200) +
geom_hline(yintercept = 400) +
theme_classic()

View file

@ -1,7 +1,7 @@
library(ggplot2) library(ggplot2)
library(sqldf) library(sqldf)
library(plyr) library(plyr)
lib library(dplyr)
library(cowplot) library(cowplot)
link_info <- read.csv("../res/tmp_graph/u.txt") link_info <- read.csv("../res/tmp_graph/u.txt")
@ -168,3 +168,5 @@ lats <- ggplot(torbw, aes(x=rate,y=lat, group=rate)) +
theme_classic() theme_classic()
lats + ggsave("tor_bw.png", dpi=300, dev='png', height=8, width=15, units="cm") lats + ggsave("tor_bw.png", dpi=300, dev='png', height=8, width=15, units="cm")
lightlinks <- read.csv("../../donar-res/tmp_light/lightning-links.csv")

35
scripts/boxplot.py Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/python3
import sys, re
current_run="none"
d = {}
input()
for line in sys.stdin:
packet_id,latency,flag,link_id,vanilla,way,run,conf = line.split(",")
conf = conf.rstrip()
if int(packet_id) > 7400 or int(packet_id) < 10: continue
latency = int(latency)
if conf not in d: d[conf] = {}
if (run,way,packet_id) not in d[conf]:
d[conf][(run,way,packet_id)] = latency
else:
d[conf][(run,way,packet_id)] = min(latency, d[conf][(run,way,packet_id)])
#print("strat,window,decile,latency")
print("links,strat,decile,latency")
for conf,value in d.items():
s = sorted(value.values())
szs = len(s)
#m = re.match(r".*tick_tock=(\d+).+window=(\d+)", conf)
m = re.match(r"^(\d+).*tick_tock=(\d+)", conf)
print(f"{m[1]},{m[2]},MIN,{s[0]}")
print(f"{m[1]},{m[2]},D0.1,{s[int(szs*0.001)]}")
print(f"{m[1]},{m[2]},D1,{s[int(szs*0.01)]}")
print(f"{m[1]},{m[2]},D25,{s[int(szs*0.25)]}")
print(f"{m[1]},{m[2]},D50,{s[int(szs*0.5)]}")
print(f"{m[1]},{m[2]},D75,{s[int(szs*0.75)]}")
print(f"{m[1]},{m[2]},D99,{s[int(szs*0.99)]}")
print(f"{m[1]},{m[2]},D99.9,{s[int(szs*0.999)]}")
print(f"{m[1]},{m[2]},MAX,{s[-1]}")

View file

@ -247,7 +247,7 @@ void monitoring(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct
uint8_t link_id = prev_links[i]; uint8_t link_id = prev_links[i];
int64_t miss_id = pkt_id - (i+1); int64_t miss_id = pkt_id - (i+1);
struct timing_entry *te = &lightc->historic[miss_id % HISTORIC_SIZE]; struct timing_entry *te = &lightc->historic[miss_id % HISTORIC_SIZE];
if (te->pkt_id == miss_id) continue; // Entry already exists if (te->pkt_id >= miss_id) continue; // Entry already exists
te->state = OOO_ONGOING; te->state = OOO_ONGOING;
te->detected_at = now; te->detected_at = now;
te->link_id = link_id; te->link_id = link_id;