/
generate.r
executable file
·58 lines (42 loc) · 1.64 KB
/
generate.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
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env RScript
library(ggplot2)
library(scales)
outputWidth=8
outputHeight=6
mysql2 <- read.table("../results/mysql2.tsv", sep="\t", header=T)
poc <- read.table("../results/poc.tsv", sep="\t", header=T)
mysql2$time = ISOdatetime(1970,1,1,0,0,0) + mysql2$time / 1000
poc$time = ISOdatetime(1970,1,1,0,0,0) + poc$time / 1000
combined <- merge(mysql2, poc, all=T)
# Bar plot
medians <- data.frame(
lib = c("mysql2", "poc"),
hz = c(median(mysql2$hz), median(poc$hz))
)
p <- ggplot(medians, aes(lib, hz, fill=lib))
p <- p + scale_y_continuous(label=comma_format(),name="hz (median)")
p + geom_bar()
ggsave(filename="bar.pdf", width=outputWidth, height=outputHeight)
# Jitter Graph
p <- ggplot(combined, aes(lib, hz, color=lib))
p <- p + scale_y_continuous(label=comma_format())
p + geom_jitter()
ggsave(filename="jitter.pdf", width=outputWidth, height=outputHeight)
# Line graph
p <- ggplot(combined, aes(time, hz, color=lib))
p <- p + scale_y_continuous(label=comma_format())
p <- p + scale_x_datetime(label=date_format("%H:%M:%S"))
p + geom_line()
ggsave(filename="line.pdf", width=outputWidth, height=outputHeight)
# Heap Used
p <- ggplot(combined, aes(time, heapUsed / 1024 / 1024, color=lib))
p <- p + labs(y = "Heap Used (MB)")
p <- p + scale_x_datetime(label=date_format("%H:%M:%S"))
p + geom_line()
ggsave(filename="heap-used-line.pdf", width=outputWidth, height=outputHeight)
# Heap Total
p <- ggplot(combined, aes(time, heapTotal / 1024 / 1024, color=lib))
p <- p + labs(y = "Heap Total (MB)")
p <- p + scale_x_datetime(label=date_format("%H:%M:%S"))
p + geom_line()
ggsave(filename="heap-total-line.pdf", width=outputWidth, height=outputHeight)