Skip to content

Commit 5e5b82d

Browse files
committed
Add code to analyse system usage
1 parent 88bfc8d commit 5e5b82d

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

analysis/packages.R

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ suppressPackageStartupMessages({
88
library(ggridges)
99
library(ggforce)
1010
library(ggrepel)
11+
library(directlabels)
1112
})

analysis/plot_system.R

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
source("tables.R")
2+
source("plots.R")
3+
4+
plotdata <- table_sysmonitor() %>%
5+
filter(id %in% c(2719, 2720, 2721)) %>%
6+
mutate(time = time / 60) # put time in minutes
7+
8+
tot_net <- 1024 * 1024
9+
10+
ggplot(plotdata, aes(x=time)) +
11+
# CPU
12+
geom_line(aes(y=cpu_user), color="darkorange") +
13+
geom_line(aes(y=mem_used / mem_total), color="darkgreen") +
14+
geom_line(aes(y=net_tx / tot_net), color="blue") +
15+
geom_line(aes(y=net_rx / tot_net), color="steelblue1") +
16+
geom_label(
17+
aes(y=cpu_user),
18+
label = "CPU",
19+
color = "darkorange",
20+
fill="white",
21+
label.size=NA,
22+
size=3,
23+
data=function (d) { group_by(d, id) %>% sample_n(1) }
24+
) +
25+
# Memory
26+
geom_label(
27+
aes(y=mem_used / mem_total),
28+
label = "Memory",
29+
color = "darkgreen",
30+
fill="white",
31+
label.size=NA,
32+
size=3,
33+
data=function (d) { group_by(d, id) %>% sample_n(1) }
34+
) +
35+
# Network
36+
geom_label(
37+
aes(y=net_tx / tot_net),
38+
label = "Net (tx)",
39+
color = "blue",
40+
fill="white",
41+
label.size=NA,
42+
size=3,
43+
data=function (d) { group_by(d, id) %>% sample_n(1) }
44+
) +
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) }
54+
) +
55+
facet_wrap(vars(id), ncol=1) +
56+
scale_y_continuous(labels=scales::percent_format(), expand=expansion(mult=0.1)) +
57+
labs(
58+
x = "time (minutes)",
59+
y = "usage"
60+
) +
61+
theme_paper()
62+
63+

analysis/tables.R

+8-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ table_sketch_quality <- function() {
104104
all
105105
}
106106

107-
108107
table_search_best <- function() {
109108
db <- DBI::dbConnect(RSQLite::SQLite(), "danny-results.sqlite")
110109
# The load is the maximum load among all the workers in a given experiment
@@ -520,3 +519,11 @@ table_bench <- function() {
520519
)
521520
)
522521
}
522+
523+
table_sysmonitor <- function() {
524+
db <- DBI::dbConnect(RSQLite::SQLite(), "danny-results.sqlite")
525+
result <- tbl(db, "result_recent") %>% collect()
526+
system <- tbl(db, "system") %>% collect()
527+
inner_join(result, system)
528+
}
529+

0 commit comments

Comments
 (0)