@@ -14,8 +14,10 @@ testnames=c(
1414)
1515
1616# ## For developers: uncomment following variables to run this as is in R
17- # resultdirs=c("")
18- # inputdir="PATH/TO/DIR/CONTAINING/testnames/WITH/ENDING/SLASH/"
17+ # resultdirs=c("PATH/TO/RES1/", ...) # keep the ending slash on result paths
18+ # inputdir=""
19+
20+ latencydata = c()
1921
2022# iterate over every set of results (test run)
2123for (currentdir in resultdirs ) {
@@ -67,34 +69,46 @@ for (currentdir in resultdirs) {
6769 # 100 4 8 10
6870 # 200 5 11 15
6971 # 300 6 14 19
72+ ltpt $ testname = testname
73+ latencydata = rbind(latencydata , ltpt )
7074 }
7175 }
7276}
7377
74- # ######### Output pod communication latency page ##############
75- ltpp = ggplot(data = ltpt , aes(x = n_pods )) + ylab(" Latency (ms)" ) + xlab(" pods" )
76- # Highlight the middle percentile (usually median)
77- # and symmetrically belittle other percentage lines
78- perc_mid = floor((perc_count + 1 )/ 2 )
79- perc_maxdist = perc_mid - 1
80- for (n in seq(perc_count )) {
81- # The sparser the dots the farther away the line is from the middle
82- perc_dist = abs(n - perc_mid )
83- if (perc_dist != 0 ) {
84- perc_linetype = paste0(2 * (1 + perc_maxdist - perc_dist ), perc_dist + 1 )
85- } else {
86- perc_linetype = " solid"
78+ if (length(latencydata [[1 ]]) < = 20 && perc_count == 5 ) {
79+ # Use boxplot when there are not too many boxes to draw
80+ latp = ggplot(data = latencydata , aes(x = n_pods )) + ylab(" Latency (ms)" ) + xlab(" pods" )
81+ p = names(ltpt )[2 : 6 ]
82+ latp = latp + geom_boxplot(aes_string(group = " interaction(testname,n_pods)" ,ymin = p [1 ],lower = p [2 ],middle = p [3 ],upper = p [4 ],ymax = p [5 ],fill = " testname" ),stat = " identity" )
83+ } else {
84+ # Use colored areas and median lines when there are many ticks on X axis
85+ latp = ggplot(data = latencydata , aes(x = n_pods )) + ylab(" Latency (ms)" ) + xlab(" pods" )
86+ perc_mid = floor((perc_count )/ 2 )
87+ perc_maxdist = perc_mid
88+ plot_number = 0
89+ for (plot_test in unique(latencydata $ testname )) {
90+ plot_number = plot_number + 1
91+ plot_color = plot_colors [plot_number ]
92+ for (n in seq(perc_mid )) {
93+ # First fill outmost areas, like p5..p25 and p75..p95,
94+ # then areas closer to the middle, like p25..p50 and p50..p75
95+ lower_name = names(ltpt )[n + 1 ]
96+ lower_next_name = names(ltpt )[n + 2 ]
97+ upper_name = names(ltpt )[perc_count - n + 2 ]
98+ upper_prev_name = names(ltpt )[perc_count - n + 1 ]
99+ perc_dist = abs(n - perc_mid )
100+ alpha = 0.4 * (n / perc_mid )** 2
101+ latp = latp + geom_ribbon(data = latencydata [latencydata $ testname == plot_test ,],aes_string(x = " n_pods" ,ymin = lower_name ,ymax = lower_next_name ,fill = " testname" ),alpha = alpha )
102+ latp = latp + geom_ribbon(data = latencydata [latencydata $ testname == plot_test ,],aes_string(x = " n_pods" ,ymin = upper_prev_name ,ymax = upper_name ,fill = " testname" ),alpha = alpha )
103+ }
104+ # Draw median line
105+ latp = latp + geom_line(data = latencydata [latencydata $ testname == plot_test ,],aes_string(x = " n_pods" ,y = names(ltpt )[perc_mid + 1 ],color = " testname" ))
87106 }
88- ltpp = ltpp + geom_line(
89- aes_string(y = names(ltpt )[n + 1 ]),
90- alpha = 1.0 - 0.4 * (perc_dist / perc_maxdist ),
91- linetype = perc_linetype ,
92- color = " blue" )
93107}
94108
95109cat(" \n\n Latency percentiles illustrated in the Figure below: " , paste0(ltp_perc , " \\ %" ), " \n\n " )
96110
97- page1 = grid.arrange(ltpp , ncol = 1 )
111+ page1 = grid.arrange(latp , ncol = 1 )
98112
99113# pagebreak, as the graphs overflow the page otherwise
100114cat(" \n\n\\ pagebreak\n " )
0 commit comments