-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkplots.r
executable file
·45 lines (40 loc) · 2.28 KB
/
mkplots.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env Rscript
# either run with:
# Rscript mkplots.r <input-file>
# or
# ./mkplots.r <input-file>
# load necessary libs
library(gridExtra)
library(ggplot2)
library(dplyr, warn.conflicts = FALSE)
# get name of file containing test results
args = commandArgs(trailingOnly=TRUE)
if (length(args) == 0)
stop("usage: mkplots.r <input-file>.n", call.=FALSE)
# the following file format is expected (generated by the "perf" sample program)
# test size container runtime min max avg var dev
# emplace 1000 tuple 2007 1.82600 14.64000 2.00717 1.09070 1.04436
# emplace 1000 vector 6828 4.50000 26.77800 6.82821 3.29125 1.81418
# emplace 1000 map 44323 38.04700 126.24600 44.32317 202.59203 14.23348
# array 1000 vector 952 0.93900 1.26500 0.95235 0.00011 0.01070
# array 1000 tuple 1038 0.91300 42.53400 1.03869 2.46011 1.56847
# array 1000 map 33040 30.48500 66.82500 33.04009 12.10746 3.47958
# iterator 1000 tuple 652 0.62400 11.25200 0.65237 0.22584 0.47522
# iterator 1000 vector 684 0.62500 15.32300 0.68472 0.23855 0.48842
# iterator 1000 map 5908 5.72200 16.55800 5.90823 0.99323 0.99661
# ...
# read test results into table
data <- read.table(args[1], header=TRUE, sep="\t")
# create runtime, min, max, avg, var, dev plots for each test and nicely arrange them into a 3x2 grid
for (t in unique(data$test)) {
cat("generating",t,"plot...","\n")
d <- data %>% filter(test == t)
p1 <- ggplot(d, aes(x=size, y=log(runtime), colour=container)) + geom_line() + ggtitle("runtime")
p2 <- ggplot(d, aes(x=size, y=log(min), colour=container)) + geom_line() + ggtitle("minimum")
p3 <- ggplot(d, aes(x=size, y=log(max), colour=container)) + geom_line() + ggtitle("maximum")
p4 <- ggplot(d, aes(x=size, y=log(avg), colour=container)) + geom_line() + ggtitle("mean")
p5 <- ggplot(d, aes(x=size, y=log(var), colour=container)) + geom_line() + ggtitle("variance")
p6 <- ggplot(d, aes(x=size, y=log(dev), colour=container)) + geom_line() + ggtitle("std-dev")
png(paste(t, ".png", sep=""), width = 1200, height = 600);
grid.arrange(p1, p2, p3, p4, p5, p6, ncol = 3);
}