-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpi_baware.R
83 lines (65 loc) · 2.18 KB
/
pi_baware.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
75
76
77
78
79
80
81
82
83
library(reshape2)
library(ggplot2)
library(RColorBrewer)
library(grid)
library(gridExtra)
g_legend<-function(a.gplot) {
tmp <- ggplot_gtable(ggplot_build(a.gplot))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
return(legend)
}
colors <- brewer.pal(6, "Paired")
mapped_colors <- c("full_throttle"=colors[1],
"full_throttle silent"=colors[2],
"managed"=colors[3],
"managed silent"=colors[4],
"energy_saver"=colors[5],
"energy_saver silent"=colors[6])
benchmarks = c("sunflow","camera","video","crypto", "javaboy")
for (b in benchmarks) {
dat = paste("pi_dat/baware_",b,"_consumed.dat", sep="")
dta <- read.table(dat, sep="\t", head=T)
out = paste("pi_dat/baware_",b,"_consumed.pdf", sep="")
pdf(out)
title = paste(b, "Battery Exception Runs")
p <- ggplot(data=dta, aes(x=data,y=energy,fill=context)) +
geom_bar(stat="identity", position=position_dodge()) +
scale_fill_brewer(palette="Paired",direction=-1) +
#ylab("Energy") +
scale_fill_manual(name="Boot Mode",values=mapped_colors) +
ggtitle(title) +
theme_gray(base_size=16) +
theme(
axis.title.y=element_blank(),
axis.title.x=element_blank(),
plot.margin=unit(c(0.3,0.5,0.1,0.0),"cm"),
legend.position="bottom",
legend.text = element_text(size=12)
) +
scale_x_discrete(limits=c("energy_saver","managed","full_throttle"))
if (b == "sunflow") {
p1 <- p
} else if (b == "camera") {
p2 <- p
} else if (b == "video") {
p3 <- p
} else if (b == "crypto") {
p4 <- p
} else if (b == "javaboy") {
p5 <- p
}
print(p)
dev.off()
}
leg <- g_legend(p1)
pdf("pi_baware_grid.pdf", width=13,height=5)
grid.arrange(
arrangeGrob(p1 + theme(legend.position="none"),
p2 + theme(legend.position="none"),
p3 + theme(legend.position="none"),
p4 + theme(legend.position="none"),
p5 + theme(legend.position="none"),
nrow=2),
leg, nrow=2, heights=c(3.8,0.5))
dev.off()