From 7f9e044b6c01d3d0c118aed1a299d44215c485f0 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Thu, 23 Jan 2020 10:48:36 +0100 Subject: [PATCH] Better logs + other stuff --- Dockerfile | 4 +- r/config_light.R | 326 ++++++++++++++++++++++++++++++++------------- src/donar_client.c | 8 +- src/donar_server.c | 2 +- src/measure.c | 5 +- src/utils.c | 7 + src/utils.h | 2 + torrc_guard_2 | 2 +- torrc_simple | 6 +- 9 files changed, 250 insertions(+), 112 deletions(-) diff --git a/Dockerfile b/Dockerfile index ec46f28..870b058 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,13 +20,13 @@ WORKDIR /home/donar-build RUN chown -R 1000 /home/donar-build USER 1000 -RUN git clone --single-branch --branch patch/relay_2 https://gitlab.inria.fr/qdufour/wide-tor.git tor2 && \ +RUN git clone --single-branch --branch patch/relay_2 https://gitlab.inria.fr/qdufour/wide-tor.git tor2 && \ cd ./tor2 && \ ./autogen.sh && \ ./configure --disable-asciidoc || cat config.log && \ make -j`nproc` -RUN git clone --single-branch --branch master https://gitlab.inria.fr/qdufour/wide-tor.git tor3 && \ +RUN git clone --single-branch --branch master https://gitlab.inria.fr/qdufour/wide-tor.git tor3 && \ cd ./tor3 && \ ./autogen.sh && \ ./configure --disable-asciidoc && \ diff --git a/r/config_light.R b/r/config_light.R index 03c8a4d..600629e 100644 --- a/r/config_light.R +++ b/r/config_light.R @@ -4,33 +4,45 @@ library(plyr) library(dplyr) library(cowplot) +scale_fill_bw_qdu_6 <- scale_fill_manual(values = c("#000000", "#333333", "#666666", "#999999", "#cccccc", "#ffffff")) +scale_fill_bw_qdu_4 <- scale_fill_manual(values = c("#000000", "#555555", "#aaaaaa", "#ffffff")) + d <- read.csv("../../donar-res/tmp_light/window3.csv") d <- d %>% mutate (window = window / 1000) 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$percentile <-factor(d$percentile,levels=c("MAX", "P99.9", "P99", "P75", "P50", "P25", "P1", "P0.1", "MIN")) -d$strat <- revalue(d$strat, c("1"="T", "0"="D")) +d$strat <- revalue(d$strat, c("1"="TickTock", "0"="Duplicate")) d <- d %>% mutate (lat = latency / 1000) -gd <- ggplot(sqldf("select * from d where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1'") %>% arrange(percentile), aes(x=strat:window,y=lat,group=percentile,fill=percentile)) + - geom_bar(stat='identity', position='identity') + +dwin <- sqldf("select * from d where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1'") %>% arrange(percentile) +gd <- ggplot(dwin, aes(x=window,y=lat,group=percentile,fill=percentile)) + + geom_bar(stat='identity', position='identity', color="black", width=1) + scale_fill_grey() + ylab("Latency (ms)") + - xlab("Strategy:Window (sec)") + + xlab("Window (sec)") + labs(fill="Percentile") + + scale_x_discrete(expand = c(0, 0)) + + scale_y_continuous(expand = c(0, 0)) + coord_cartesian(ylim=c(0,600)) + - geom_hline(yintercept = 200) + - geom_hline(yintercept = 400) + - theme_classic() + geom_hline(yintercept = 160, linetype="dashed", color="white") + + annotate("text", x=4, y=160, label = "QoS: OWD best", vjust = -1, color="white") + + geom_hline(yintercept = 360) + + annotate("text", x=4, y=360, label = "QoS: OWD limit", vjust = -1,color="black") + + theme_classic() + + theme(legend.position="none") + + facet_grid( . ~ strat) + e <- read.csv("../../donar-res/tmp_light/links3.csv") e$strat <- as.factor(e$strat) e$links <- as.factor(e$links) -e$strat <- revalue(e$strat, c("1"="T", "0"="D")) +e$strat <- revalue(e$strat, c("1"="TickTock", "0"="Duplicate")) e$percentile <-factor(e$percentile,levels=c("MAX", "P99.9", "P99", "P75", "P50", "P25", "P1", "P0.1", "MIN")) e <- e %>% mutate (lat = latency / 1000) +elinks <- sqldf("select * from e where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1' and links != 6 and links != 4") %>% arrange(percentile) ge <- ggplot(sqldf("select * from e where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1' and links != 6 and links != 4") %>% arrange(percentile), aes(x=strat:links,y=lat,group=percentile,fill=percentile)) + - geom_bar(stat='identity', position='identity') + + geom_bar(stat='identity', position='identity', width=1, color="black") + scale_fill_grey() + ylab("Latency (ms)") + xlab("Strategy:Links") + @@ -42,11 +54,12 @@ ge <- ggplot(sqldf("select * from e where percentile != 'MAX' and percentile != f <- read.csv("../../donar-res/tmp_light/fast3.csv") f$strat <- as.factor(f$strat) -f$strat <- revalue(f$strat, c("1"="T", "0"="D")) +f$strat <- revalue(f$strat, c("1"="TickTock", "0"="Duplicate")) f$fast_count <- as.factor(f$fast_count) f$percentile <-factor(f$percentile,levels=c("MAX", "P99.9", "P99", "P75", "P50", "P25", "P1", "P0.1", "MIN")) f <- f %>% mutate (lat = latency / 1000) -gf <- ggplot(sqldf("select * from f where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1'") %>% arrange(percentile), aes(x=strat:fast_count,y=lat,group=percentile,fill=percentile)) + +ffast <- sqldf("select * from f where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1'") %>% arrange(percentile) +gf <- ggplot(ffast, aes(x=strat:fast_count,y=lat,group=percentile,fill=percentile)) + geom_bar(stat='identity', position='identity') + scale_fill_grey() + geom_hline(yintercept = 200) + @@ -57,84 +70,166 @@ gf <- ggplot(sqldf("select * from f where percentile != 'MAX' and percentile != labs(fill="Percentile") + theme_classic() -plot_grid(gd, ge, gf, ncol=1) + ggsave("light_config.pdf", dpi=300, dev='pdf', height=17, width=15, units="cm") +plot_grid(gd, gdbis, ge, ge, gf, gf, ncol=3) + + ggsave("light_config.pdf", dpi=300, dev='pdf', height=17, width=15, units="cm") + +mega <- sqldf(" +select window as variable, lat, strat, percentile, 'Window (sec)' as variable_name from dwin +union +select links as variable, lat, strat, percentile, '# of total links' as variable_name from elinks +union +select fast_count as variable, lat, strat, percentile, '# of fast links' as variable_name from ffast +") %>% arrange(percentile) + +mega$percentile <- revalue(mega$percentile, c("P99.9" = "99.9%", "P99" = "99%", "P75"="75%", "P50" = "50%", "P25" = "25%", "MIN" = "Min")) +mega$variable <- factor(mega$variable, levels =c("0.2", "1", "2", "3", "4", "5", "6", "8", "10", "12", "13", "14", "16", "20", "34")) + +QoS <- data.frame(x = c(1.2, 1.5), name = c("bar", "foo")) + +ggplot(mega, aes(x=variable,y=lat,group=percentile,fill=percentile)) + + geom_bar(stat='identity', position='identity', color="black", width=1) + + scale_fill_bw_qdu_6 + + ylab("Latency (ms)") + + xlab("Protocol Parameter Value") + + labs(fill="Distribution") + + scale_x_discrete(expand = c(0, 0)) + + scale_y_continuous(expand = c(0, 0)) + + coord_cartesian(ylim=c(0,600)) + + geom_hline(aes(yintercept = 110, linetype="Target One Way Delay"), color="grey") + + #annotate("text", x=4, y=160, label = "OWD best", vjust = 1.5, color="white") + + geom_hline(aes(yintercept = 360, linetype="Max One Way Delay"), color="grey") + + #annotate("text", x=4, y=360, label = "OWD limit", vjust = -1, color="black") + + theme_classic() + + theme(legend.position="top", + legend.direction = "horizontal", + legend.box = "vertical", + panel.spacing.y = unit(4, "mm"), + strip.placement = "outside", + legend.margin=margin(t = -0.1, unit='cm')) + + guides(fill = guide_legend(nrow = 1)) + + facet_grid(strat ~ variable_name, scales = "free", switch = "x") + + scale_linetype_manual(name = "QoS", values = c(1, 2), guide = guide_legend(override.aes = list(linetype = c("solid", "dashed")))) + + ggsave("light_config.pdf", dpi=300, dev='pdf', height=12.5, width=12.5, units="cm") + + g <- read.csv("../../donar-res/tmp_light/guards.csv") g$strat <- as.factor(g$strat) -g$strat <- revalue(g$strat, c("1"="T", "0"="D")) +g$strat <- revalue(g$strat, c("1"="TickTock", "0"="Duplicate")) g$guard <- as.factor(g$guard) +g$percentile <- revalue(g$percentile, c("MAX" = "100%", "P99.9"="99.9%", "P99"="99%", "P75" = "75%", "P50"="50%","P25"="25%","P1"="1%","P0.1"="0.1%","MIN"="Min")) g$guard <- revalue(g$guard, c("guard_1"="1", "guard_3"="3", "guard_5"="5", "guard_7"="7", "guard_9"="9", "guard_11"="11", "simple"="inf")) g$guard <- factor(g$guard, levels=c("1", "3", "5", "7", "9", "11", "inf")) -g$percentile <-factor(g$percentile,levels=c("MAX", "P99.9", "P99", "P75", "P50", "P25", "P1", "P0.1", "MIN")) +g$percentile <-factor(g$percentile,levels=c("100%", "99.9%", "99%", "75%", "50%", "25%", "1%", "0.1%", "Min")) g <- g %>% mutate (lat = latency / 1000) -gg <- ggplot(sqldf("select * from g where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1' ") %>% arrange(percentile), aes(x=strat:guard,y=lat,group=percentile,fill=percentile)) + - geom_bar(stat='identity', position='identity') + - scale_fill_grey() + - geom_hline(yintercept = 200) + - geom_hline(yintercept = 400) + +gg <- ggplot(sqldf("select * from g where percentile != '100%' and percentile != '1%' and percentile != '0.1%' ") %>% arrange(percentile), aes(x=guard,y=lat,group=percentile,fill=percentile)) + + geom_bar(stat='identity', position='identity', width=1, color="black") + + scale_fill_bw_qdu_6 + + scale_x_discrete(expand = c(0, 0)) + + scale_y_continuous(expand = c(0, 0)) + coord_cartesian(ylim=c(0,600)) + ylab("Latency (ms)") + - xlab("Strategy:Guards") + - labs(fill="Percentile") + - theme_classic() + xlab("# of guards") + + labs(fill="Distribution") + + scale_linetype_manual(name = "QoS", values = c(1, 2), guide = guide_legend(override.aes = list(linetype = c("solid", "dashed")))) + + geom_hline(aes(yintercept = 110, linetype="Target One Way Delay"), color="grey") + + geom_hline(aes(yintercept = 360, linetype="Max One Way Delay"), color="grey") + + facet_grid(. ~ strat, scales = "free", switch = "x") + + theme_classic() + + guides(fill = guide_legend(nrow = 1)) + + theme(strip.placement = "outside", + legend.position="top", + legend.direction = "horizontal", + legend.box = "vertical", + legend.margin=margin(t = -0.2, l=-0.8, unit='cm')) -gg + ggsave("light_guards.png", dpi=300, dev='png', height=7, width=15, units="cm") +gg + ggsave("light_guards.pdf", dpi=300, dev='pdf', height=7.5, width=12.5, units="cm") h <- read.csv("../../donar-res/tmp_light/complem.csv") -h$strat <- revalue(h$strat, c("ticktock"="T", "duplicate"="D")) -h$percentile <-factor(h$percentile,levels=c("MAX", "P99.9", "P99", "P75", "P50", "P25", "P1", "P0.1", "MIN")) +h$strat <- revalue(h$strat, c("ticktock"="TickTock", "duplicate"="Duplicate")) +h$percentile <- revalue(h$percentile, c("MAX" = "100%", "P99.9"="99.9%", "P99"="99%", "P75" = "75%", "P50"="50%","P25"="25%","P1"="1%","P0.1"="0.1%","MIN"="Min")) +h$percentile <-factor(h$percentile,levels=c("100%", "99.9%", "99%", "75%", "50%", "25%", "1%", "0.1%", "Min")) h$mode <- factor(h$mode, levels=c("no_redundancy", "no_scheduler", "donar")) h$mode <- revalue(h$mode, c("no_redundancy" = "scheduler", "no_scheduler" = "padding", "donar"="both")) h <- h %>% mutate (lat = latency / 1000) -gh <- ggplot(sqldf("select * from h where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1' ") %>% arrange(percentile), aes(x=strat:mode,y=lat,group=percentile,fill=percentile)) + - geom_bar(stat='identity', position='identity') + - scale_fill_grey() + - geom_hline(yintercept = 200) + - geom_hline(yintercept = 400) + +gh <- ggplot(sqldf("select * from h where percentile != '100%' and percentile != '1%' and percentile != '0.1%' ") %>% arrange(percentile), aes(x=mode,y=lat,group=percentile,fill=percentile)) + + geom_bar(stat='identity', position='identity', width=1, color="black") + + scale_fill_bw_qdu_6 + + scale_x_discrete(expand = c(0, 0)) + + scale_y_continuous(expand = c(0, 0)) + + scale_linetype_manual(name = "QoS", values = c(1, 2), guide = guide_legend(override.aes = list(linetype = c("solid", "dashed")))) + + geom_hline(aes(yintercept = 110, linetype="Target One Way Delay"), color="grey") + + geom_hline(aes(yintercept = 360, linetype="Max One Way Delay"), color="grey") + coord_cartesian(ylim=c(0,500)) + ylab("Latency (ms)") + - xlab("Strategy:Feature") + - labs(fill="Percentile") + - theme_classic() -gh + ggsave("light_complementary.png", dpi=300, dev='png', height=7, width=15, units="cm") + xlab("Feature") + + labs(fill="Distribution") + + facet_grid(. ~ strat, scales = "free", switch = "x") + + theme_classic() + + guides(fill = guide_legend(nrow = 1)) + + theme(strip.placement = "outside", + legend.position="top", + legend.direction = "horizontal", + legend.box = "vertical", + legend.margin=margin(t = -0.2, l=-0.8, unit='cm')) + +gh + ggsave("light_complementary.pdf", dpi=300, dev='pdf', height=7.5, width=12.5, units="cm") i <- read.csv("../../donar-res/tmp_light/battle.csv") -i$percentile <- revalue(i$percentile, c("MAX" = "100%", "P99.9"="99.9%", "P99"="99%", "P75" = "75%", "P50"="50%","P25"="25%","P1"="1%","P0.1"="0.1%","MIN"="0%")) -i$percentile <-factor(i$percentile,levels=c("100%", "99.9%", "99%", "75%", "50%", "25%", "1%", "0.1%", "0%")) +i$percentile <- revalue(i$percentile, c("MAX" = "100%", "P99.9"="99.9%", "P99"="99%", "P75" = "75%", "P50"="50%","P25"="25%","P1"="1%","P0.1"="0.1%","MIN"="Min")) +i$percentile <-factor(i$percentile,levels=c("100%", "99.9%", "99%", "75%", "50%", "25%", "1%", "0.1%", "Min")) i <- i %>% mutate (lat = latency / 1000) i$secmode <- factor(i$secmode, levels=c("hardened", "default", "light")) i$algo <- factor(i$algo, levels=c("simple", "dup2", "lightning-ticktock", "lightning-dup")) i$algo <- revalue(i$algo, c("dup2"="torfone", "simple"="simple", "lightning-ticktock"="donar-ticktock", "lightning-dup"="donar-dup")) -gi <- ggplot(sqldf("select * from i where percentile != '100%' and percentile != '1%' and percentile != '0.1%' and secmode = 'default' ") %>% arrange(percentile), aes(x=algo,y=lat,group=percentile,fill=percentile)) + - geom_bar(stat='identity', position='identity',width=1) + - #scale_fill_grey() + +gi <- ggplot(sqldf("select * from i where percentile != '100%' and percentile != '1%' and percentile != '0.1%' ") %>% arrange(percentile), aes(x=algo,y=lat,group=percentile,fill=percentile)) + + geom_bar(stat='identity', position='identity',width=1,color="black") + + scale_fill_bw_qdu_6 + scale_y_continuous(expand = c(0, 0)) + scale_x_discrete(expand = c(0, 0)) + - scale_fill_viridis_d() + - geom_hline(yintercept = 200) + - geom_hline(yintercept = 400) + + #scale_fill_viridis_d() + + geom_hline(aes(yintercept = 110, linetype="Target One Way Delay"), color="grey") + + geom_hline(aes(yintercept = 360, linetype="Max One Way Delay"), color="grey") + coord_cartesian(ylim=c(0,600)) + ylab("Latency (ms)") + xlab("Algorithm") + - labs(fill="Distribution") +#, title="linear scale, zoomed") + + labs(fill="Distribution", title="linear scale, cropped") + theme_classic() + - theme(axis.text.x = element_text(angle = 10, hjust=1), plot.margin = unit(c(0.3,0.2,0.2,1), "cm")) -gibis <- ggplot(sqldf("select * from i where percentile != 'MAX' and percentile != 'P1' and percentile != 'P0.1' ") %>% arrange(percentile), aes(x=algo:secmode,y=lat,group=percentile,fill=percentile)) + - geom_bar(stat='identity', position='identity') + - scale_fill_grey() + - scale_y_log10() + - #geom_hline(yintercept = 200) + - #geom_hline(yintercept = 400) + - coord_cartesian(ylim=c(100,250000)) + - ylab("Latency (ms)") + - xlab("Algorithm:Security Profile") + - labs(fill="Percentile", title="log scale, full") + - theme_classic() + - theme(axis.text.x = element_text(angle = 20, hjust=1), plot.margin = unit(c(0.2,0.2,0.2,1), "cm")) - -plot_grid(gibis, gi, ncol=1) + ggsave("light_battle.png", dpi=300, dev='png', height=12, width=15, units="cm") + scale_linetype_manual(name = "QoS", values = c(1, 2), guide = guide_legend(override.aes = list(linetype = c("solid", "dashed")))) + + guides(fill = guide_legend(nrow = 1)) + + facet_grid(. ~ secmode, scales = "free", switch = "x") + + theme(axis.text.x = element_text(angle = 20, hjust=1), + plot.margin = unit(c(0.3,0.2,0.2,1), "cm"), + strip.placement = "outside", + legend.position="none", + legend.direction = "horizontal", + legend.box = "vertical", + legend.margin=margin(t = -0.1, unit='cm')) -gi + ggsave("battle_color.pdf", dpi=300, dev='pdf', height=7, width=12, units='cm') +gibis <- ggplot(sqldf("select * from i where percentile != '100%' and percentile != '1%' and percentile != '0.1%' ") %>% arrange(percentile), aes(x=algo,y=lat,group=percentile,fill=percentile)) + + geom_bar(stat='identity', position='identity', color="black", width=1) + + scale_fill_bw_qdu_6 + + scale_y_log10() + + #geom_hline(aes(yintercept = 160, linetype="Target One Way Delay"), color="grey") + + #geom_hline(aes(yintercept = 360, linetype="Max One Way Delay"), color="grey") + + scale_x_discrete(expand = c(0, 0)) + + coord_cartesian(ylim=c(30,250000)) + + ylab("Latency (ms)") + + xlab("Algorithm") + + labs(fill="Distribution", title="log scale, full") + + facet_grid(. ~ secmode, scales = "free", switch = "x") + + theme_classic() + + theme(legend.position="none", + axis.text.x = element_text(angle = 20, hjust=1), + plot.margin = unit(c(0.2,0.2,0.2,1), "cm"), + strip.placement = "outside") + +gilegend <- get_legend(gi + theme(legend.position = "top")) + +plot_grid(gilegend, plot_grid(gibis, gi, align="v", ncol=1), ncol=1, rel_heights = c(1,6)) + + ggsave("light_battle.pdf", dpi=300, dev='pdf', height=15, width=12.5, units="cm") + +#gi + ggsave("battle_color.pdf", dpi=300, dev='pdf', height=7, width=12, units='cm') fastprobe = read.csv(text= " @@ -159,78 +254,119 @@ gj <- ggplot(fastprobe, aes(x=group:pad, y=count, fill=strat)) + theme(axis.text.x = element_text(angle = 20, hjust=1)) gj + ggsave("light_fastprobe.png", dpi=300, dev='png', height=7, width=15, units="cm") +fastprobe2 = read.csv(text=" +strat,schedule_state,packet_position,ratio +Ticktock,tick,original on 1st class,0.946975638 +Ticktock,tick,piggybacked on 2nd class,0.053025421 +Ticktock,tock,original on 2nd class,0.474113253 +Ticktock,tock,piggybacked on 1st class,0.525885688 +Duplicate,all,original on 1st class,0.7349205324574037 +Duplicate,all,piggybacked on 1st class,0.13431755481879454 +Duplicate,all,original on 2nd class,0.1154165656941915 +Duplicate,all,piggybacked on 2nd class,0.015345347029610245 +") +fastprobe2$schedule_state <-factor(fastprobe2$schedule_state,levels=c("all", "tock", "tick")) +ggplot(fastprobe2, aes(x=schedule_state, y=ratio, fill=packet_position)) + + geom_bar(stat='identity', position='stack', width=1, color="black") + + facet_grid(strat ~ ., scales = "free", switch = "x") + + scale_y_continuous(expand = c(0, 0), labels = scales::percent) + + scale_x_discrete(expand = c(0, 0)) + + scale_fill_bw_qdu_4 + + xlab("Schedule State") + + ylab("Fastest Delivery") + + labs(fill="Scheduling Decision") + + coord_flip() + + theme_classic() + + ggsave("light_fastprobe.pdf", dpi=300, dev='pdf', height=5, width=12.5, units="cm") + + fastlinks = read.csv(text= " link_count,occ_count,strat -5,0,ticktock -9,0.20634920634920634,ticktock -8,0.25396825396825395,ticktock -7,0.1111111111111111,ticktock -6,0.1746031746031746,ticktock -10,0.1746031746031746,ticktock -11,0.07936507936507936,ticktock -12,0,ticktock -9,0.19047619047619047,duplicate -8,0.14285714285714285,duplicate -10,0.20634920634920634,duplicate -7,0.09523809523809523,duplicate -6,0.09523809523809523,duplicate -11,0.14285714285714285,duplicate -5,0.015873015873015872,duplicate -12,0.1111111111111111,duplicate +5,0,Ticktock +9,0.20634920634920634,Ticktock +8,0.25396825396825395,Ticktock +7,0.1111111111111111,Ticktock +6,0.1746031746031746,Ticktock +10,0.1746031746031746,Ticktock +11,0.07936507936507936,Ticktock +12,0,Ticktock +9,0.19047619047619047,Duplicate +8,0.14285714285714285,Duplicate +10,0.20634920634920634,Duplicate +7,0.09523809523809523,Duplicate +6,0.09523809523809523,Duplicate +11,0.14285714285714285,Duplicate +5,0.015873015873015872,Duplicate +12,0.1111111111111111,Duplicate ") gk <- ggplot(fastlinks, aes(x=link_count, y=occ_count, fill=strat)) + - geom_bar(stat='identity', position='dodge') + + geom_bar(stat='identity', position='dodge', color="black") + scale_fill_grey() + - ylab("Runs") + + ylab("Calls") + xlab("Links fast at least once") + labs(fill="Strategy") + - scale_y_continuous(labels = scales::percent) + + scale_y_continuous(expand = c(0, 0), labels = scales::percent) + + scale_x_continuous(expand = c(0, 0)) + theme_classic() #theme(axis.text.x = element_text(angle = 20, hjust=1)) -gk + ggsave("light_fastlinks.png", dpi=300, dev='png', height=7, width=15, units="cm") - +gk + ggsave("light_fastlinks.pdf", dpi=300, dev='pdf', height=6, width=12.5, units="cm") l <- read.csv("../../donar-res/tmp_light/basic.csv") l <- l %>% mutate (lat = latency / 1000) gl <- ggplot(sqldf("select * from l where way='client'"), aes(x=packet_id,y=lat)) + coord_cartesian(ylim=c(0,500)) + - geom_hline(yintercept = 200) + - geom_hline(yintercept = 400) + + scale_y_continuous(expand = c(0, 0)) + + scale_x_continuous(expand = c(0, 0)) + xlab("Packet Identifier") + ylab("Latency (ms)") + labs(linetype="Way") + - geom_point() + - theme_classic() -gl + ggsave("light_single.png", dpi=300, dev='png', height=7, width=15, units="cm") + geom_point(size=0.1) + + geom_hline(aes(yintercept = 110, linetype="Target One Way Delay"), color="white") + + geom_hline(aes(yintercept = 360, linetype="Max One Way Delay"), color="grey") + + scale_linetype_manual(name = "QoS", values = c(1, 2), guide = guide_legend(override.aes = list(linetype = c("solid", "dashed")))) + + theme_classic() + + theme(legend.position="top",legend.margin=margin(t = -0.1, b = -0.1, unit='cm')) +#gl + ggsave("light_single.png", dpi=300, dev='png', height=7, width=15, units="cm") m <- read.csv("../../donar-res/tmp_light/fp.csv") m <- m %>% mutate (lat = latency / 1000) +m$group <- revalue(m$group, c("fast" = "1st class links", "probe" = "2nd class links")) gm <- ggplot(sqldf("select * from m where `way`='client'"), aes(x=packet_id,y=lat,color=group)) + scale_color_grey() + coord_cartesian(ylim=c(0,500)) + - geom_hline(yintercept = 200) + - geom_hline(yintercept = 400) + + scale_y_continuous(expand = c(0, 0)) + + scale_x_continuous(expand = c(0, 0)) + xlab("Packet Identifier") + ylab("Latency (ms)") + - labs(color="Group") + + labs(color="Link Group") + labs(linetype="Way") + - geom_point() + - theme_classic() + geom_point(size=0.1) + + geom_hline(yintercept = 110, linetype="dashed", color="white") + + geom_hline(yintercept = 360, linetype="solid", color="grey") + + guides(color = guide_legend(override.aes = list(size=2))) + + theme_classic() + + theme(legend.position="top", legend.margin=margin(t = -0.1, b = -0.1, unit='cm')) n <- read.csv("../../donar-res/tmp_light/linkgroup.csv") -n$group <- revalue(n$group, c("fast" = "fast link", "probe" = "other link")) +n$group <- revalue(n$group, c("fast" = "1st class links", "probe" = "2nd class links")) +#n$link_id <- as.factor(n$link_id) gn <- ggplot(n, aes(x=packet_id, y=link_id, color=group)) + scale_color_grey() + + scale_fill_grey() + + geom_point(size=0.6) + + scale_y_continuous(expand = c(0.1, 0.1)) + + scale_x_continuous(expand = c(0, 0)) + #scale_color_viridis_d() + xlab("Packet Identifier") + ylab("Link Identifier") + - labs(color="Group") + - geom_point() + - theme_classic() + labs(color="Link group") + + #geom_tile() + + theme_classic() + + theme(legend.position="none") -plot_grid(gl, gm, gn, ncol=1) + ggsave("light_single.png", dpi=300, dev='png', height=17, width=15, units="cm") +plot_grid(gl, gm, gn, ncol=1,align="v",rel_heights = c(1.3,1.3,1)) + ggsave("light_single.pdf", dpi=300, dev='pdf', height=12.5, width=12.5, units="cm") gn+ggsave("links_group.pdf", dpi=300, dev='pdf', height=7, width=15, units="cm") diff --git a/src/donar_client.c b/src/donar_client.c index 23ec18b..e58d62a 100644 --- a/src/donar_client.c +++ b/src/donar_client.c @@ -71,7 +71,7 @@ void init_socks5_sinks(struct donar_client_ctx* app_ctx) { int donar_client_stream_repair(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { // @FIXME: Ugly way to get donar_client_ctx. Shame on me :/ - fprintf(stdout, "[donar-client] %s broke\n", fdinfo->url); + fprintf(stdout, "[%s][donar-client] %s broke\n", current_human_datetime (), fdinfo->url); struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "socks5-failed"); if (cat == NULL) { fprintf(stderr, "Unable to reconnect stream as socks5-failed cat is not available...\n"); @@ -99,14 +99,14 @@ int donar_client_stream_repair(struct evt_core_ctx* ctx, struct evt_core_fdinfo* } if (removed == 2) { - fprintf(stdout, "[donar-client] Retriggering socks5 for port %d\n", port); + fprintf(stdout, "[%s][donar-client] Retriggering socks5 for port %d\n", current_human_datetime (), port); init_socks5_client (app_ctx, pos); return 0; } else if (removed == 0) { - fprintf(stdout, "[donar-client] Socks5 has already been retriggered for port %d\n", port); + fprintf(stdout, "[%s][donar-client] Socks5 has already been retriggered for port %d\n", current_human_datetime (), port); return 0; } else { - fprintf(stderr, "[donar-client] We only removed 1 link and not 2 for port %d, strange behaviour, exiting...\n", port); + fprintf(stderr, "[%s][donar-client] We only removed 1 link and not 2 for port %d, strange behaviour, exiting...\n", current_human_datetime (), port); exit(EXIT_FAILURE); } } diff --git a/src/donar_server.c b/src/donar_server.c index 26f5a0f..ff6dedb 100644 --- a/src/donar_server.c +++ b/src/donar_server.c @@ -53,7 +53,7 @@ socket_create_err: struct tor_ctl* ugly_global_tctl; int donar_server_stream_repair(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fd) { - fprintf(stderr, "I am a server, I do nothing with broken streams...\n"); + fprintf(stderr, "[%s][donar-server] I am a server, I do nothing with broken streams...\n", current_human_datetime ()); tor_ctl_list_onions(ugly_global_tctl); return 1; } diff --git a/src/measure.c b/src/measure.c index 83a6e1c..630978e 100644 --- a/src/measure.c +++ b/src/measure.c @@ -12,9 +12,6 @@ void measure_parse(int size, struct measure_conf* mc) { perror("clock_gettime error"); exit(EXIT_FAILURE); } - time_t now; - time(&now); - char* ctime_no_newline = strtok(ctime(&now), "\n"); micro_sec = elapsed_micros (&head->emit_time, &curr); uint8_t is_slow = head->flag >> 7; @@ -22,7 +19,7 @@ void measure_parse(int size, struct measure_conf* mc) { uint8_t link_id = head->flag & 0x3f; printf( "[%s] Packet %llu latency %luµs with flag %d sent on link %d with vanilla %d\n", - ctime_no_newline, + current_human_datetime(), (unsigned long long)head->counter, micro_sec, is_slow, diff --git a/src/utils.c b/src/utils.c index 3387762..d3cc6f3 100644 --- a/src/utils.c +++ b/src/utils.c @@ -147,3 +147,10 @@ void timespec_set_unit(struct timespec *t, uint64_t value, enum time_units unit) uint64_t timespec_get_unit(struct timespec *t, enum time_units unit) { return t->tv_sec * (SEC / unit) + t->tv_nsec / unit; } + +char* current_human_datetime() { + time_t now; + time(&now); + char* ctime_no_newline = strtok(ctime(&now), "\n"); + return ctime_no_newline; +} diff --git a/src/utils.h b/src/utils.h index e6a90d7..eaae9fc 100644 --- a/src/utils.h +++ b/src/utils.h @@ -44,3 +44,5 @@ uint8_t timespec_lt(struct timespec *t1, struct timespec *t2); void timespec_diff(struct timespec *end, struct timespec *begin, struct timespec *result); void timespec_set_unit(struct timespec *t, uint64_t value, enum time_units unit); uint64_t timespec_get_unit(struct timespec *t, enum time_units unit); + +char* current_human_datetime(); diff --git a/torrc_guard_2 b/torrc_guard_2 index 06eb455..903908e 100644 --- a/torrc_guard_2 +++ b/torrc_guard_2 @@ -3,4 +3,4 @@ UseEntryGuards 1 NumEntryGuards 2 NumPrimaryGuards 2 SafeLogging 0 -#Log INFO stdout +#Log DEBUG stdout diff --git a/torrc_simple b/torrc_simple index 1065f39..2a1bbdd 100644 --- a/torrc_simple +++ b/torrc_simple @@ -1,9 +1,5 @@ ControlPort 9051 - UseEntryGuards 0 - SafeLogging 0 - -IsolateDestPort 1 - +#IsolateDestPort 1 #Log INFO stdout