@@ -2,62 +2,109 @@ source("tables.R")
2
2
source(" plots.R" )
3
3
4
4
plotdata <- table_sysmonitor() %> %
5
- filter(id %in% c(2719 , 2720 , 2721 )) %> %
5
+ ungroup() %> %
6
+ filter(hostname == " desktop2" ) %> %
6
7
mutate(time = time / 60 ) # put time in minutes
7
8
8
- tot_net <- 1024 * 1024
9
+ tot_net <- plotdata % > % summarise(max( net_tx )) % > % pull()
9
10
10
- ggplot(plotdata , aes(x = time )) +
11
+ endtimes <- plotdata %> %
12
+ group_by(algorithm ) %> %
13
+ summarise(end_local = max(time ))
14
+
15
+ plotdata %> %
16
+ group_by(algorithm ) %> %
17
+ mutate(net_frac = net_tx / max(net_tx )) %> %
18
+ filter(net_frac > 0.1 ) %> %
19
+ summarise(start_comm = min(time ), end_comm = max(time ), comm_span = 60 * (end_comm - start_comm )) %> %
20
+ inner_join(endtimes ) %> %
21
+ mutate(span_local = 60 * (end_local - end_comm ), span_init = 60 * start_comm )
22
+
23
+ annotations <- tribble(
24
+ ~ algorithm , ~ from , ~ to , ~ text , ~ y , ~ ytext ,
25
+ " TwoLevelLSH" , 0.5 , 1.4 , " 58 s" , 0.25 , 0.12 ,
26
+ " TwoLevelLSH" , 1.5 , 6.5 , " 307 s" , 0.15 , 0.25 ,
27
+ " TwoLevelLSH" , 0 , 0.45 , " 29 s" , 0.75 , 0.55 ,
28
+ " OneLevelLSH" , 0.12 , 1.2 , " 68 s" , 0.25 , 0.12 ,
29
+ " OneLevelLSH" , 1.22 , 6.1 , " 293 s" , 0.75 , 0.55 ,
30
+ " LocalLSH" , 4 , 4 , " Initialization: 2 s" , NA , 0.75 ,
31
+ " LocalLSH" , 4 , 4 , " Communication: 16 s" , NA , 0.5 ,
32
+ " LocalLSH" , 4 , 4 , " Local computation: 44 s" , NA , 0.25 ,
33
+ )
34
+
35
+ percent_idx <- function (p ) {
36
+ as.integer(quantile(1 : n(), p ))
37
+ }
38
+
39
+ ggplot(plotdata , aes(x = time , group = hostname )) +
11
40
# CPU
12
- geom_line(aes(y = cpu_user ), color = " darkorange" ) +
13
- geom_line(aes(y = mem_used / mem_total ), color = " darkgreen" ) +
14
41
geom_line(aes(y = net_tx / tot_net ), color = " blue" ) +
15
42
geom_line(aes(y = net_rx / tot_net ), color = " steelblue1" ) +
43
+ geom_line(aes(y = cpu_user ), color = " darkorange" ) +
44
+ geom_ribbon(aes(
45
+ ymax = (mem_used / mem_total ) + 0.02 ,
46
+ ymin = (mem_used / mem_total ) - 0.02
47
+ ),
48
+ fill = " white"
49
+ ) +
50
+ geom_line(aes(y = mem_used / mem_total ), color = " darkgreen" ) +
16
51
geom_label(
17
- aes(y = cpu_user ),
52
+ aes(y = cpu_user , hjust = 0 ),
18
53
label = " CPU" ,
19
54
color = " darkorange" ,
20
55
fill = " white" ,
56
+ alpha = 0.0 ,
21
57
label.size = NA ,
22
- size = 3 ,
23
- data = function (d ) { group_by(d , id ) %> % sample_n( 1 ) }
58
+ size = 2.5 ,
59
+ data = function (d ) { group_by(d , id ) %> % slice(percent_idx( .99 ) ) }
24
60
) +
25
61
# Memory
26
62
geom_label(
27
- aes(y = mem_used / mem_total ),
63
+ aes(y = mem_used / mem_total , hjust = 0 ),
28
64
label = " Memory" ,
29
65
color = " darkgreen" ,
30
66
fill = " white" ,
67
+ alpha = 0.0 ,
31
68
label.size = NA ,
32
- size = 3 ,
33
- data = function (d ) { group_by(d , id ) %> % sample_n( 1 ) }
69
+ size = 2.5 ,
70
+ data = function (d ) { group_by(d , id ) %> % slice(percent_idx( 0.99 ) ) }
34
71
) +
35
72
# Network
36
73
geom_label(
37
- aes(y = net_tx / tot_net ),
38
- label = " Net (tx) " ,
74
+ aes(y = net_tx / tot_net , hjust = 0 ),
75
+ label = " Network " ,
39
76
color = " blue" ,
40
77
fill = " white" ,
78
+ alpha = 0.0 ,
41
79
label.size = NA ,
42
- size = 3 ,
43
- data = function (d ) { group_by(d , id ) %> % sample_n( 1 ) }
80
+ size = 2.5 ,
81
+ data = function (d ) { group_by(d , id ) %> % slice(percent_idx( 0.99 ) ) }
44
82
) +
45
- # Network
46
- geom_label(
47
- aes(y = net_rx / tot_net ),
48
- label = " Net (rx)" ,
49
- color = " steelblue1" ,
50
- fill = " white" ,
51
- label.size = NA ,
52
- size = 3 ,
53
- data = function (d ) { group_by(d , id ) %> % sample_n(1 ) }
83
+ geom_segment(
84
+ aes(y = y , yend = y , x = from , xend = to ),
85
+ data = annotations ,
86
+ inherit.aes = F ,
87
+ linetype = " dotted" ,
88
+ size = .4
89
+ ) +
90
+ geom_text(
91
+ aes(y = ytext , x = (from + to )/ 2 , label = text ),
92
+ data = annotations ,
93
+ inherit.aes = F ,
94
+ size = 2.5
54
95
) +
55
- facet_wrap(vars(id ), ncol = 1 ) +
96
+ facet_wrap(vars(algorithm ), ncol = 1 ) +
56
97
scale_y_continuous(labels = scales :: percent_format(), expand = expansion(mult = 0.1 )) +
98
+ scale_x_continuous(expand = expansion(add = c(0.3 , 1 ))) +
57
99
labs(
58
100
x = " time (minutes)" ,
59
101
y = " usage"
60
102
) +
61
- theme_paper()
103
+ theme_paper() +
104
+ theme(
105
+ panel.border = element_rect(size = 0.5 ),
106
+ panel.grid = element_blank()
107
+ )
62
108
109
+ ggsave(" imgs/system.png" , width = 4 , height = 3 )
63
110
0 commit comments