Add R files and improve graph

This commit is contained in:
Quentin 2019-09-06 10:05:48 +02:00
parent efbd019c04
commit e36a8b4fe9
4 changed files with 87 additions and 1 deletions

75
r/tor_daemon.R Normal file
View file

@ -0,0 +1,75 @@
library(ggplot2)
library(sqldf)
library(plyr)
library(cowplot)
cellssec <- c("1","2","10","20")
tor_bw <- read.csv("tor_bw_2.csv")
tor_bw <- sqldf("select run,conf,latency, CAST(latency as real) / 1000. as lat_ms from tor_bw")
tor_bw$conf <- as.factor(tor_bw$conf)
gbw1 <- ggplot(data = tor_bw, aes(x = conf, y=lat_ms)) +
geom_boxplot() +
ylim(0,1000) +
ylab("latency (in ms)") +
xlab("cells / second") +
theme_minimal()
gbw2 <- ggplot(data = tor_bw, aes(x = conf, y=lat_ms)) +
geom_boxplot() +
scale_y_log10() +
ylab("latency (in ms)") +
xlab("cells / second") +
theme_minimal()
new_values <- c("1","2","3","4","5","6","7","8","∞")
tor_guards <- read.csv("tor_guards.csv")
tor_guards <- sqldf("select run,conf,latency, CAST(latency as real) / 1000. as lat_ms from tor_guards")
tor_guards$conf <- factor(
mapvalues(tor_guards$conf, c(0,1,2,3,4,5,6,7,8), new_values),
levels = new_values,
ordered = TRUE)
gguard1 <- ggplot(data = tor_guards, aes(x = conf, y=lat_ms)) +
geom_boxplot() +
ylim(0,1000) +
ylab("latency (in ms)") +
xlab("guards") +
theme_minimal()
gguard2 <- ggplot(data = tor_guards, aes(x = conf, y=lat_ms)) +
geom_boxplot() +
scale_y_log10() +
ylab("latency (in ms)") +
xlab("guards") +
theme_minimal()
relay_count <- c("6","4","3")
tor_relays <- read.csv("tor_relays.csv")
tor_relays <- sqldf("select run,conf,latency, CAST(latency as real) / 1000. as lat_ms from tor_relays")
tor_relays$conf <- factor(
mapvalues(tor_relays$conf, c(0,1,2), relay_count),
levels = relay_count,
ordered = TRUE)
grelay1 <- ggplot(data = tor_relays, aes(x = conf, y=lat_ms)) +
geom_boxplot() +
ylim(0,1000) +
#scale_y_log10() +
ylab("latency (in ms)") +
xlab("relay count") +
theme_minimal()
grelay2 <- ggplot(data = tor_relays, aes(x = conf, y=lat_ms)) +
geom_boxplot() +
scale_y_log10() +
ylab("latency (in ms)") +
xlab("relay count") +
theme_minimal()
t1 <- plot_grid(gbw1, gguard1, grelay1, labels = c('D', 'E', 'F'), nrow=1, rel_widths = c(5, 8, 4))
t1 + ggsave("tor_latency_crop.png", dpi=300, dev='png', height=5, width=15, units="cm")
t2 <- plot_grid(gbw2, gguard2, grelay2, labels = c('A', 'B', 'C'), nrow=1, rel_widths = c(5, 8, 4))
t2 + ggsave("tor_latency_log.png", dpi=300, dev='png', height=5, width=15, units="cm")

BIN
r/tor_latency_crop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
r/tor_latency_log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -30,16 +30,20 @@ tor_bw_full:
orig-client 600 1000 100, \
orig-client 1200 500 100, \
orig-client 6000 100 100, \
orig-client 12000 50 100 . \
orig-client 12000 50 100, \
orig-client 30000 20 100 . \
orig-server, \
orig-server, \
orig-server, \
orig-server, \
orig-server . \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple . \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple, \
tor3 -f /etc/torrc_simple
@ -108,6 +112,10 @@ tor_guards_full:
tor3 -f /etc/torrc_guard_8, \
tor3 -f /etc/torrc_simple
tor_guards_full_parse:
@. parse_lib.sh && \
parse_latency tor_guards_full 8
tor_relays_full:
./run-3 \
16,tor_relays_full . \
@ -140,3 +148,6 @@ tor_relays_small:
tor2 -f /etc/torrc_simple, \
tor2 -f /etc/torrc_single_hop
tor_relays_full_parse:
@. parse_lib.sh && \
parse_latency tor_relays_full 2