forked from JulianKunkel/md-workbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyze-stats-files.R
executable file
·74 lines (56 loc) · 3.12 KB
/
analyze-stats-files.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env Rscript
library(ggplot2)
options(echo=FALSE)
args = commandArgs(trailingOnly = TRUE)
input = args[1]
if (length(args) > 1){
process = args[2]
}else{
process = 0
}
if (length(args) > 2){
xlimTimeline = xlim(0, as.integer(args[3]))
}else{
xlimTimeline = theme(legend.position="bottom")
}
# now we have to read three files
d1 = read.csv(sprintf("%s-create-%s.csv", input, process))
d1$type = as.factor("create")
print(sprintf("create quantiles 0.1: %e 0.9: %e", quantile(d1$runtime, 0.1), quantile(d1$runtime,0.9)))
print(summary(d1$runtime))
d2 = read.csv(sprintf("%s-read-%s.csv", input, process))
d2$type = as.factor("read")
print(sprintf("read quantiles 0.1: %e 0.9: %e", quantile(d2$runtime, 0.1), quantile(d2$runtime,0.9)))
print(summary(d2$runtime))
d3 = read.csv(sprintf("%s-delete-%s.csv", input, process))
d3$type = as.factor("delete")
print(sprintf("delete quantiles 0.1: %e 0.9: %e", quantile(d3$runtime, 0.1), quantile(d3$runtime,0.9)))
print(summary(d3$runtime))
d4 = read.csv(sprintf("%s-stat-%s.csv", input, process))
d4$type = as.factor("stat")
print(sprintf("stat quantiles 0.1: %e 0.9: %e", quantile(d4$runtime, 0.1), quantile(d4$runtime,0.9)))
print(summary(d4$runtime))
lim = scale_y_log10(limits=c(1e-4, 10))
lim = scale_y_log10()
d = rbind(d1, d2, d3, d4)
p = ggplot(d, aes(x=time,y=runtime,col=type)) + geom_point(alpha=.4, size=1) + xlab("time") + ylab("runtime") + lim + theme(legend.position="bottom") + xlimTimeline
ggsave(sprintf("%s-timeline-%s.pdf", input, process), plot=p, width=8, height=5)
p = ggplot(d, aes(x=runtime,col=type)) + geom_density(alpha=.2) + scale_x_log10(limits=c(1e-4, 10)) +
theme(legend.position="bottom") # + geom_histogram(aes(y=..density..), binwidth=.5, colour="black", fill="white")
ggsave(sprintf("%s-density-%s.pdf", input, process), plot=p, width=8, height=5)
p = ggplot(d, aes(x=type, y=runtime, fill=type)) + xlab("") + geom_boxplot() + lim + theme(legend.position="bottom")
ggsave(sprintf("%s-runtime-%s.pdf", input, process), plot=p, width=8, height=5)
d = d[ order(d$runtime),]
d$pos = (1:nrow(d))/nrow(d)
p = ggplot(d, aes(x=pos, y=runtime,col=type)) + geom_point(alpha=.4, size=1) + xlab("fraction of measurements") + ylab("runtime") + lim + theme(legend.position="bottom")
ggsave(sprintf("%s-waittimes-all-%s.pdf", input, process), plot=p, width=8, height=5)
p = ggplot(d, aes(x=pos, y=runtime,col=type)) + geom_point(alpha=.4, size=1) + xlab("fraction of measurements") + ylab("runtime") + lim + facet_grid(type ~ .) + theme(legend.position="none")
ggsave(sprintf("%s-waittimes-%s.pdf", input, process), plot=p, width=8, height=5)
d = d[ order(d$type, d$runtime),]
d$pos = 1
d$pos[1:nrow(d1)] = (1:nrow(d1))/nrow(d1)
d$pos[(1*nrow(d1)+1):(2*nrow(d1))] = (1:nrow(d1))/nrow(d1)
d$pos[(2*nrow(d1)+1):(3*nrow(d1))] = (1:nrow(d1))/nrow(d1)
d$pos[(3*nrow(d1)+1):(4*nrow(d1))] = (1:nrow(d1))/nrow(d1)
p = ggplot(d, aes(x=pos, y=runtime,col=type)) + geom_point(alpha=.4, size=1) + xlab("fraction of measurements") + ylab("runtime") + scale_y_log10() + facet_grid(type ~ .) + theme(legend.position="none")
ggsave(sprintf("%s-waittimes-ind-%s.pdf", input, process), plot=p, width=8, height=5)