-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.r
More file actions
executable file
·70 lines (61 loc) · 2.62 KB
/
plot.r
File metadata and controls
executable file
·70 lines (61 loc) · 2.62 KB
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
#!/usr/bin/env Rscript
pdf(NULL) # Avoid creating Rplots.pdf
library(ggplot2)
scenarios <- sub('.log', '', list.files('./log'))
means = c()
errs = c()
plotsdir <- './plots/'
dir.create(plotsdir, showWarnings=FALSE)
for(scenario in scenarios) {
filename <- paste('./log/', scenario, '.log', sep='')
data <- read.csv(file=filename, head=FALSE)
error <- qt(0.975, df=length(data$V1)-1)*sd(data$V1)/sqrt(length(data$V1))
means[scenario] = mean(data$V1)
errs[scenario] = error
# Boxplot.
png(filename=paste(plotsdir, scenario, '-boxplot.png', sep=''))
boxplot(data$V1)
dev.off()
}
# Bar plot with error bars.
scenarios <- c('Instrumented\nMicroservices', 'No Tracing', 'Rbinder')
plotdata <- data.frame(scenarios, means, errs)
colnames(plotdata) <- c('scenario', 'mean', 'err')
print(plotdata)
theme_set(theme_bw())
fills <- c("instr", "no_tracing", "rbinder")
plot <- ggplot(data=plotdata, aes(x=scenario, y=mean, fill=fills)) +
geom_bar(stat="identity", colour="black", width=.2) +
geom_errorbar(aes(ymin=mean-err, ymax=mean+err),
width=.05,
position=position_dodge(.9)) +
theme(text = element_text(size=18))
plot + labs(x="", y="Response Time (s)") +
scale_fill_manual("legend",
values = c("instr"="white",
"rbinder"="white",
"no_tracing"="white"),
guide=FALSE)
ggsave(filename=paste(plotsdir, 'means.pdf', sep=''), height=3)
# Overhead bar plot.
overhead = c()
overerrs = c()
overhead["instrumented"] = means["instrumented"] / means["no_tracing"]
overhead["rbinder"] = means["rbinder"] / means["no_tracing"]
overerrs["instrumented"] = errs["instrumented"] / means["no_tracing"]
overerrs["rbinder"] = errs["rbinder"] / means["no_tracing"]
scenarios <- c("Instrumented Microservices", "Proxies + Syscalls Monitoring")
overdata <- data.frame(scenarios, overhead, overerrs)
colnames(overdata) <- c('scenario', 'overhead', 'err')
print(means["no_tracing"])
print(overdata)
fills <- c("instr", "rbinder")
plot <- ggplot(data=overdata, aes(x=scenario, y=overhead, fill=fills)) +
geom_bar(stat="identity", colour="black") +
geom_errorbar(aes(ymin=overhead-err, ymax=overhead+err),
width=.2,
position=position_dodge(.9))
plot + labs(x="", y="Response Time Overhead") +
coord_cartesian(ylim=c(0, 1.3)) +
scale_fill_manual("legend", values = c("instr" = "white", "rbinder" = "gray"), guide=FALSE)
ggsave(filename=paste(plotsdir, 'overhead.pdf', sep=''), height=3)