-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.sh
More file actions
executable file
·147 lines (107 loc) · 5.05 KB
/
plot.sh
File metadata and controls
executable file
·147 lines (107 loc) · 5.05 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/local/bin/Rscript
library(extrafont)
loadfonts()
draw_plot <- function(name, displayName, iguana, antlr) {
output <- paste(name, ".pdf", sep="")
pdf(output, width=10, height=2.5, family="CM Roman")
par(mar=c(2, 2, 0.2, 0.2))
boxplot(iguana$Score, antlr$Score, horizontal=TRUE, boxwex=0.5, outline=FALSE, names=c("Iguana", "ANTLR"), cex=1.5, ylim=c(0,43))
title(displayName, adj=0.98, line=-1.5)
text(x = boxplot.stats(round(iguana$Score, 2))$stats[1], labels = boxplot.stats(round(iguana$Score, 2))$stats[1], y = 0.62)
text(x = boxplot.stats(round(iguana$Score, 2))$stats[3], labels = boxplot.stats(round(iguana$Score, 2))$stats[3], y = 0.62)
text(x = boxplot.stats(round(iguana$Score, 2))$stats[5], labels = boxplot.stats(round(iguana$Score, 2))$stats[5], y = 0.62)
text(x = boxplot.stats(round(antlr$Score, 2))$stats[1], labels = boxplot.stats(round(antlr$Score, 2))$stats[1], y = 1.62)
text(x = boxplot.stats(round(antlr$Score, 2))$stats[3], labels = boxplot.stats(round(antlr$Score, 2))$stats[3], y = 1.62)
text(x = boxplot.stats(round(antlr$Score, 2))$stats[5], labels = boxplot.stats(round(antlr$Score, 2))$stats[5], y = 1.62)
dev.off()
}
draw_relative_plot <- function(name, displayName, data) {
output <- paste(name, ".pdf", sep="")
pdf(output, width=12, height=6, family="CM Roman")
boxplot(data, horizontal=TRUE, names = c("Relative performance"), outline=FALSE)
text(x = boxplot.stats(round(data, 2))$stats, labels = boxplot.stats(round(data, 2))$stats, y = 0.55)
text(x = boxplot.stats(round(data, 2))$stats[1], labels = boxplot.stats(round(data, 2))$stats[1], y = 0.62)
text(x = boxplot.stats(round(data, 2))$stats[3], labels = boxplot.stats(round(data, 2))$stats[3], y = 0.62)
text(x = boxplot.stats(round(data, 2))$stats[5], labels = boxplot.stats(round(data, 2))$stats[5], y = 0.62)
dev.off()
}
all_draw_relative_plot <- function(iguana, antlr) {
output <- paste("all_relative.pdf", sep="")
pdf(output, width=8, height=8, family="CM Roman")
relative <- list();
for (i in 1:6) {
relative[[i]] <- iguana[[i]]$Score / antlr[[i]]$Score
}
labels <- c("Junit 4", "Elastic Search", "Guava", "RxJava", "OpenJDK 7", "All Projects")
par(mar=c(2, 2, 1, 1))
boxplot(relative[[1]], relative[[2]], relative[[3]], relative[[4]], relative[[5]], relative[[6]],
horizontal=TRUE, names=labels, boxwex=0.5, outline=FALSE, cex=1.5)
for (i in 1:6) {
text(x = boxplot.stats(round(relative[[i]], 2))$stats[1], labels = boxplot.stats(round(relative[[i]], 2))$stats[1], y = i - 1 + 0.62)
text(x = boxplot.stats(round(relative[[i]], 2))$stats[3], labels = boxplot.stats(round(relative[[i]], 2))$stats[3], y = i - 1 + 0.62)
text(x = boxplot.stats(round(relative[[i]], 2))$stats[5], labels = boxplot.stats(round(relative[[i]], 2))$stats[5], y = i - 1 + 0.62)
}
dev.off()
}
draw_hist <- function() {
data <- data.frame()
for (i in 1:5) {
name <- names[i]
data <- rbind(data, read.csv(paste("benchmark_data/", name, "_file_size.csv", sep=""), header=TRUE, sep=",", dec=",", stringsAsFactors=FALSE))
}
pdf("histogram.pdf", width=8, height=8, family="CM Roman")
hist(data$size, breaks = 100)
dev.off()
embed_fonts("histogram.pdf", outfile="embedded_histogram.pdf")
}
calc_max <- function(iguana, antlr) {
relative <- iguana$Score / antlr$Score
data <- iguana
data$relative <- iguana$Score / antlr$Score
data <- data[order(data$relative),]
print(head(data, 10))
print(tail(data, 10))
}
names <- c("junit4", "guava", "elasticsearch", "RxJava", "jdk7u-jdk", "total")
displayNames <- c("Junit 4", "Guava", "Elastic Search", "RxJava", "OpenJDK 7", "All Projects")
total_iguana <- data.frame()
total_antlr <- data.frame()
data_iguana <- list()
data_antlr <- list()
for (i in 1:5) {
name <- names[i]
displayName <- displayNames[i]
iguana <- read.csv(paste("Iguana_", name, ".csv", sep=""), header=TRUE, sep=",", dec=",", stringsAsFactors=FALSE)
iguana[, "Score"] <- as.numeric(iguana[, "Score"])
total_iguana <- rbind(total_iguana, iguana)
antlr <- read.csv(paste("Antlr_", name, ".csv", sep=""), header=TRUE, sep=",", dec=",", stringsAsFactors=FALSE)
antlr[, "Score"] <- as.numeric(antlr[, "Score"])
total_antlr <- rbind(total_antlr, antlr)
print(length(iguana$Score))
print(length(antlr$Score))
data_iguana[[i]] <- iguana
data_antlr[[i]] <- antlr
}
data_antlr[[6]] <- total_antlr
data_iguana[[6]] <- total_iguana
for (i in 1:length(names)) {
name <- names[i]
displayName <- displayNames[i]
draw_plot(name, displayName, data_iguana[[i]], data_antlr[[i]])
}
for (i in 1:length(names)) {
name <- names[i]
displayName <- displayNames[i]
relative <- data_iguana[[i]]$Score / data_antlr[[i]]$Score
draw_relative_plot(paste("relative_", name, sep=""), displayName, relative)
}
all_draw_relative_plot(data_iguana, data_antlr)
for (name in names) {
output <- paste(name, ".pdf", sep="")
embedded_output <- paste("embedded_", output, sep="")
embed_fonts(output, outfile=embedded_output)
}
draw_hist()
calc_max(data_iguana[[6]], data_antlr[[6]])
embed_fonts("total.pdf", outfile="embedded_total.pdf")
embed_fonts("all_relative.pdf", outfile="embedded_all_relative.pdf")