tor_multipath_voip/r/lightning_begin.R
2019-10-18 17:29:49 +02:00

129 lines
3.6 KiB
R

library(ggplot2)
library(sqldf)
library(plyr)
library(cowplot)
link_info <- read.csv("../res/tmp_graph/u.txt")
ggplot(data=link_info, aes(x=timestamp, y=link, color=speed)) +
#geom_line() +
geom_point() +
theme_classic()
xx <- read.csv("../res/tmp_light/q.csv")
xx2 <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx group by packet_id,way")
ggplot(data=xx2, aes(x=packet_id, y=lat, color=way)) +
geom_line() +
geom_hline(yintercept=400) +
geom_hline(yintercept=200) +
coord_cartesian(ylim=c(0,1000)) +
#geom_point() +
theme_classic()
xx4 <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx where flag = 0 group by packet_id,way")
ggplot(data=xx4, aes(x=packet_id, y=lat, color=way)) +
geom_line() +
geom_hline(yintercept=400) +
geom_hline(yintercept=200) +
coord_cartesian(ylim=c(0,1000)) +
#geom_point() +
theme_classic()
xx5 <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx where flag = 1 group by packet_id,way")
ggplot(data=xx5, aes(x=packet_id, y=lat, color=way)) +
geom_line() +
geom_hline(yintercept=400) +
geom_hline(yintercept=200) +
coord_cartesian(ylim=c(0,1000)) +
#geom_point() +
theme_classic()
prepros <- sqldf(
"select
r.packet_id,
r.way,
r.lat,
s.flag
from
(select
packet_id,
way,
min(latency) as lat
from xx
group by packet_id,way) as r,
xx as s
where
s.packet_id = r.packet_id and
s.way = r.way and
r.lat = s.latency")
xx3 <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,flag,way from xx group by packet_id,way,flag")
xx3$flag <- factor(xx3$flag)
ggplot(data=xx3, aes(x=lat, group=flag, color=flag)) +
stat_ecdf(pad = FALSE) +
geom_vline(xintercept = 200) +
geom_vline(xintercept = 400) +
coord_cartesian(xlim=c(0,1200)) +
theme_classic()
xy <- read.csv("../res/tmp_light/light.csv")
xz <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run")
xz$conf <- factor(xz$conf)
ggplot(data=xz, aes(x=lat, group=conf, color=conf)) +
stat_ecdf(pad = FALSE) +
geom_vline(xintercept = 200) +
geom_vline(xintercept = 400) +
coord_cartesian(xlim=c(0,600)) +
theme_classic()
ggplot(data=xz, aes(y=lat, x=conf)) +
geom_violin(scale='width') +
geom_boxplot(width=0.1, outlier.shape=NA) +
theme_classic()
xa <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where flag=1 and packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run")
ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x=packet_id, y=lat, color=way)) +
geom_line() +
geom_hline(yintercept=400) +
geom_hline(yintercept=200) +
coord_cartesian(ylim=c(0,1000)) +
#geom_point(aes(shape=conf)) +
theme_classic()
xb <- read.csv("../res/tmp_light/t.csv")
xb$flag <- factor(xb$flag)
xb$link_id <- factor(xb$link_id)
xc <- sqldf("select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 7")
ggplot(data=xc, aes(x=packet_id, y=lat, color=link_id:way)) +
coord_cartesian(ylim=c(100,600)) +
geom_line() +
#geom_point() +
theme_classic()
xd <- sqldf("
select
lat,
xb.latency,
vanilla,
xb.packet_id,
xb.way,
link_id,
flag
from
(select
packet_id,way,latency,1.0 * MIN(latency) / 1000 as lat
from xb
group by packet_id,way) nn,
xb
where
xb.latency = nn.latency and
xb.packet_id = nn.packet_id and
xb.way = nn.way
")
ggplot(data=xd, aes(x=packet_id, y=lat, color=link_id)) +
#coord_cartesian(ylim=c(0,1000),xlim=c(3200,3500)) +
geom_line() +
theme_classic()