2019-10-31 17:05:47 +00:00
library ( ggplot2 )
library ( sqldf )
library ( plyr )
library ( dplyr )
2019-11-01 14:34:23 +00:00
library ( cowplot )
2019-10-31 17:05:47 +00:00
2019-11-02 16:53:27 +00:00
d <- read.csv ( " ../../donar-res/tmp_light/window3.csv" )
d <- d %>% mutate ( window = window / 1000 )
2019-10-31 17:05:47 +00:00
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"))
2019-11-02 16:53:27 +00:00
d $ percentile <- factor ( d $ percentile , levels = c ( " MAX" , " P99.9" , " P99" , " P75" , " P50" , " P25" , " P1" , " P0.1" , " MIN" ) )
2019-11-01 14:34:23 +00:00
d $ strat <- revalue ( d $ strat , c ( " 1" = " T" , " 0" = " D" ) )
2019-10-31 17:05:47 +00:00
d <- d %>% mutate ( lat = latency / 1000 )
2019-11-02 16:53:27 +00:00
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 ) ) +
2019-10-31 17:05:47 +00:00
geom_bar ( stat = ' identity' , position = ' identity' ) +
scale_fill_grey ( ) +
2019-11-01 14:34:23 +00:00
ylab ( " Latency (ms)" ) +
2019-11-02 16:53:27 +00:00
xlab ( " Strategy:Window (sec)" ) +
labs ( fill = " Percentile" ) +
2019-11-01 14:34:23 +00:00
coord_cartesian ( ylim = c ( 0 , 600 ) ) +
2019-10-31 17:05:47 +00:00
geom_hline ( yintercept = 200 ) +
geom_hline ( yintercept = 400 ) +
theme_classic ( )
2019-11-02 14:19:15 +00:00
e <- read.csv ( " ../../donar-res/tmp_light/links3.csv" )
2019-10-31 17:05:47 +00:00
e $ strat <- as.factor ( e $ strat )
e $ links <- as.factor ( e $ links )
2019-11-01 14:34:23 +00:00
e $ strat <- revalue ( e $ strat , c ( " 1" = " T" , " 0" = " D" ) )
2019-11-02 16:53:27 +00:00
e $ percentile <- factor ( e $ percentile , levels = c ( " MAX" , " P99.9" , " P99" , " P75" , " P50" , " P25" , " P1" , " P0.1" , " MIN" ) )
2019-10-31 17:05:47 +00:00
e <- e %>% mutate ( lat = latency / 1000 )
2019-11-02 16:53:27 +00:00
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 ) ) +
2019-10-31 17:05:47 +00:00
geom_bar ( stat = ' identity' , position = ' identity' ) +
scale_fill_grey ( ) +
2019-11-01 14:34:23 +00:00
ylab ( " Latency (ms)" ) +
xlab ( " Strategy:Links" ) +
2019-11-02 16:53:27 +00:00
labs ( fill = " Percentile" ) +
2019-10-31 17:05:47 +00:00
geom_hline ( yintercept = 200 ) +
geom_hline ( yintercept = 400 ) +
2019-11-01 14:34:23 +00:00
coord_cartesian ( ylim = c ( 0 , 600 ) ) +
2019-10-31 17:05:47 +00:00
theme_classic ( )
2019-11-01 14:34:23 +00:00
2019-11-02 16:53:27 +00:00
f <- read.csv ( " ../../donar-res/tmp_light/fast3.csv" )
2019-11-01 14:34:23 +00:00
f $ strat <- as.factor ( f $ strat )
f $ strat <- revalue ( f $ strat , c ( " 1" = " T" , " 0" = " D" ) )
f $ fast_count <- as.factor ( f $ fast_count )
2019-11-02 16:53:27 +00:00
f $ percentile <- factor ( f $ percentile , levels = c ( " MAX" , " P99.9" , " P99" , " P75" , " P50" , " P25" , " P1" , " P0.1" , " MIN" ) )
2019-11-01 14:34:23 +00:00
f <- f %>% mutate ( lat = latency / 1000 )
2019-11-02 16:53:27 +00:00
gf <- ggplot ( sqldf ( " select * from f where percentile != 'MAX' and percentile != 'D1' and percentile != 'D0.1'" ) %>% arrange ( percentile ) , aes ( x = strat : fast_count , y = lat , group = percentile , fill = percentile ) ) +
2019-11-01 14:34:23 +00:00
geom_bar ( stat = ' identity' , position = ' identity' ) +
scale_fill_grey ( ) +
geom_hline ( yintercept = 200 ) +
geom_hline ( yintercept = 400 ) +
coord_cartesian ( ylim = c ( 0 , 600 ) ) +
ylab ( " Latency (ms)" ) +
xlab ( " Strategy:Fast Links" ) +
2019-11-02 16:53:27 +00:00
labs ( fill = " Percentile" ) +
2019-11-01 14:34:23 +00:00
theme_classic ( )
2019-11-02 16:53:27 +00:00
plot_grid ( gd , ge , gf , ncol = 1 ) + ggsave ( " light_config.png" , dpi = 300 , dev = ' png' , height = 17 , width = 15 , units = " cm" )
g <- read.csv ( " ../../donar-res/tmp_light/guards.csv" )
2019-11-02 14:19:15 +00:00
g $ strat <- as.factor ( g $ strat )
g $ strat <- revalue ( g $ strat , c ( " 1" = " T" , " 0" = " D" ) )
g $ guard <- as.factor ( g $ guard )
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" ) )
2019-11-02 16:53:27 +00:00
g $ percentile <- factor ( g $ percentile , levels = c ( " MAX" , " P99.9" , " P99" , " P75" , " P50" , " P25" , " P1" , " P0.1" , " MIN" ) )
2019-11-02 14:19:15 +00:00
g <- g %>% mutate ( lat = latency / 1000 )
2019-11-02 16:53:27 +00:00
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 ) ) +
2019-11-02 14:19:15 +00:00
geom_bar ( stat = ' identity' , position = ' identity' ) +
scale_fill_grey ( ) +
geom_hline ( yintercept = 200 ) +
geom_hline ( yintercept = 400 ) +
coord_cartesian ( ylim = c ( 0 , 600 ) ) +
ylab ( " Latency (ms)" ) +
xlab ( " Strategy:Guards" ) +
theme_classic ( )
2019-11-02 16:53:27 +00:00
gg + ggsave ( " light_guards.png" , dpi = 300 , dev = ' png' , height = 7 , width = 15 , units = " cm" )