2019-10-08 14:48:00 +00:00
library ( ggplot2 )
library ( sqldf )
library ( plyr )
2019-10-31 17:05:47 +00:00
library ( dplyr )
2019-10-08 14:48:00 +00:00
library ( cowplot )
2019-10-11 12:45:21 +00:00
link_info <- read.csv ( " ../res/tmp_graph/u.txt" )
2019-10-08 14:48:00 +00:00
ggplot ( data = link_info , aes ( x = timestamp , y = link , color = speed ) ) +
#geom_line() +
geom_point ( ) +
theme_classic ( )
2019-10-22 15:42:20 +00:00
xx <- read.csv ( " ../../donar-res/tmp_light/v2.csv" )
2019-10-09 15:07:51 +00:00
xx2 <- sqldf ( " select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx group by packet_id,way" )
2019-10-08 14:48:00 +00:00
ggplot ( data = xx2 , aes ( x = packet_id , y = lat , color = way ) ) +
2019-10-09 15:07:51 +00:00
geom_line ( ) +
2019-10-16 13:07:34 +00:00
geom_hline ( yintercept = 400 ) +
geom_hline ( yintercept = 200 ) +
coord_cartesian ( ylim = c ( 0 , 1000 ) ) +
2019-10-09 15:07:51 +00:00
#geom_point() +
2019-10-08 14:48:00 +00:00
theme_classic ( )
2019-10-09 15:41:16 +00:00
2019-10-16 13:07:34 +00:00
xx4 <- sqldf ( " select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx where flag = 0 group by packet_id,way" )
2019-10-11 09:01:09 +00:00
ggplot ( data = xx4 , aes ( x = packet_id , y = lat , color = way ) ) +
geom_line ( ) +
2019-10-16 13:07:34 +00:00
geom_hline ( yintercept = 400 ) +
geom_hline ( yintercept = 200 ) +
2019-10-15 12:22:45 +00:00
coord_cartesian ( ylim = c ( 0 , 1000 ) ) +
2019-10-11 09:01:09 +00:00
#geom_point() +
theme_classic ( )
2019-10-16 13:07:34 +00:00
xx5 <- sqldf ( " select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx where flag = 1 group by packet_id,way" )
2019-10-11 09:01:09 +00:00
ggplot ( data = xx5 , aes ( x = packet_id , y = lat , color = way ) ) +
geom_line ( ) +
2019-10-16 13:07:34 +00:00
geom_hline ( yintercept = 400 ) +
geom_hline ( yintercept = 200 ) +
2019-10-15 12:22:45 +00:00
coord_cartesian ( ylim = c ( 0 , 1000 ) ) +
2019-10-11 09:01:09 +00:00
#geom_point() +
theme_classic ( )
2019-10-09 15:41:16 +00:00
prepros <- sqldf (
" s e l e c t
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 " )
2019-10-11 09:01:09 +00:00
2019-10-16 13:07:34 +00:00
xx3 <- sqldf ( " select packet_id,1.0 * MIN(latency) / 1000.0 as lat,flag,way from xx group by packet_id,way,flag" )
2019-10-11 09:01:09 +00:00
xx3 $ flag <- factor ( xx3 $ flag )
ggplot ( data = xx3 , aes ( x = lat , group = flag , color = flag ) ) +
stat_ecdf ( pad = FALSE ) +
2019-10-16 14:45:10 +00:00
geom_vline ( xintercept = 200 ) +
geom_vline ( xintercept = 400 ) +
2019-10-15 12:22:45 +00:00
coord_cartesian ( xlim = c ( 0 , 1200 ) ) +
2019-10-11 09:01:09 +00:00
theme_classic ( )
2019-10-18 13:05:02 +00:00
2019-10-22 15:42:20 +00:00
xy <- read.csv ( " ../../donar-res/tmp_light/light.csv" )
2019-10-18 13:05:02 +00:00
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 ( )
2019-10-22 15:42:20 +00:00
xa <- sqldf ( " select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy group by packet_id,way,conf,run" )
2019-10-22 16:38:26 +00:00
ggplot ( data = sqldf ( " select * from xa where run='out/I0mj7t5OJu9DGMq1-6'" ) , aes ( x = packet_id , y = lat , color = way ) ) +
2019-10-18 13:05:02 +00:00
geom_line ( ) +
geom_hline ( yintercept = 400 ) +
geom_hline ( yintercept = 200 ) +
coord_cartesian ( ylim = c ( 0 , 1000 ) ) +
#geom_point(aes(shape=conf)) +
theme_classic ( )
2019-10-18 15:29:49 +00:00
2019-10-22 15:42:20 +00:00
xb <- read.csv ( " ../../donar-res/tmp_light/v1.csv" )
2019-10-18 15:29:49 +00:00
xb $ flag <- factor ( xb $ flag )
xb $ link_id <- factor ( xb $ link_id )
2019-10-22 15:42:20 +00:00
xc <- sqldf ( " select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 5" )
2019-10-18 15:29:49 +00:00
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 ( )
2019-10-18 16:08:56 +00:00
ggplot ( data = sqldf ( " s e l e c t
packet_id , way , latency , 1.0 * MIN ( latency ) / 1000 as lat
from xb
group by packet_id , way " ) , a e s ( x = p a c k e t _ i d , y = l a t , c o l o r = w a y ) ) +
coord_cartesian ( ylim = c ( 100 , 600 ) ) +
geom_line ( ) +
#geom_point() +
theme_classic ( )
2019-10-18 15:29:49 +00:00
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 ( )
2019-10-22 09:09:36 +00:00
2019-10-22 15:42:20 +00:00
ggplot ( data = sqldf ( " select * from xb where vanilla = 1 and way= 'client'" ) , aes ( x = packet_id , y = link_id , color = flag ) ) +
2019-10-22 09:09:36 +00:00
geom_point ( ) +
theme_classic ( )
2019-10-22 09:26:13 +00:00
2019-10-24 13:52:03 +00:00
torbw <- read.csv ( " ../../donar-res/tmp_light/tor_bw.csv" )
torbw <- sqldf ( " select *, 1.0 * latency / 1000.0 as lat from torbw" )
torbw2 <- torbw %>%
dplyr :: group_by ( rate ) %>%
dplyr :: summarise (
third = quantile ( lat , 0.75 ) ,
median = median ( lat )
)
coefs <- coef ( lm ( median ~ rate , data = torbw2 ) )
coefs2 <- coef ( lm ( third ~ rate , data = torbw2 ) )
lats <- ggplot ( torbw , aes ( x = rate , y = lat , group = rate ) ) +
coord_cartesian ( ylim = c ( 0 , 650 ) ) +
geom_hline ( yintercept = 400 , linetype = " dashed" ) +
geom_hline ( yintercept = 200 , linetype = " dashed" ) +
ylab ( " latency (ms)" ) +
xlab ( " packets/sec" ) +
geom_abline ( intercept = coefs [1 ] , slope = coefs [2 ] ) +
geom_abline ( intercept = coefs2 [1 ] , slope = coefs2 [2 ] ) +
geom_boxplot ( outlier.shape = NA ) +
theme_classic ( )
lats + ggsave ( " tor_bw.png" , dpi = 300 , dev = ' png' , height = 8 , width = 15 , units = " cm" )
2019-10-31 17:05:47 +00:00
lightlinks <- read.csv ( " ../../donar-res/tmp_light/lightning-links.csv" )