forked from basho/basho_bench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsummary.r
More file actions
executable file
·122 lines (95 loc) · 4.61 KB
/
summary.r
File metadata and controls
executable file
·122 lines (95 loc) · 4.61 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
#!/usr/bin/env Rscript
# Parse the --file= argument out of command line args and
# determine where base directory is so that we can source
# our common sub-routines
arg0 <- sub("--file=(.*)", "\\1", grep("--file=", commandArgs(), value = TRUE))
dir0 <- dirname(arg0)
source(file.path(dir0, "common.r"))
theme_set(theme_grey(base_size = 17))
# Setup parameters for the script
params = matrix(c(
'help', 'h', 0, "logical",
'width', 'x', 2, "integer",
'height', 'y', 2, "integer",
'outfile', 'o', 2, "character",
'indir', 'i', 2, "character",
'tstart', '1', 2, "integer",
'tend', '2', 2, "integer",
'ylabel1stgraph', 'Y', 2, "character",
'title', 't', 2, "character"
), ncol=4, byrow=TRUE)
# Parse the parameters
opt = getopt(params)
if (!is.null(opt$help))
{
cat(paste(getopt(params, command = basename(arg0), usage = TRUE)))
q(status=1)
}
# Initialize defaults for opt
if (is.null(opt$width)) { opt$width = 1280 }
if (is.null(opt$height)) { opt$height = 960 }
if (is.null(opt$indir)) { opt$indir = "current"}
if (is.null(opt$outfile)) { opt$outfile = file.path(opt$indir, "summary.png") }
if (is.null(opt$ylabel1stgraph)) { opt$ylabel1stgraph = "Ops/sec" }
if (is.null(opt$title)) { opt$title = "Throughput" }
# Load the benchmark data, passing the time-index range we're interested in
b = load_benchmark(opt$indir, opt$tstart, opt$tend)
# If there is no actual data available, bail
if (nrow(b$latencies) == 0)
{
stop("No latency information available to analyze in ", opt$indir)
}
png(file = opt$outfile, width = opt$width, height = opt$height)
# First plot req/sec from summary
plot1 <- qplot(elapsed, successful / window, data = b$summary,
geom = c("smooth", "point"),
xlab = "Elapsed Secs", ylab = opt$ylabel1stgraph,
main = opt$title) +
geom_smooth(aes(y = successful / window, colour = "ok"), size=0.5) +
geom_point(aes(y = successful / window, colour = "ok"), size=2.0) +
geom_smooth(aes(y = failed / window, colour = "error"), size=0.5) +
geom_point(aes(y = failed / window, colour = "error"), size=2.0) +
scale_colour_manual("Response", values = c("#FF665F", "#188125"))
# Setup common elements of the latency plots
latency_plot <- ggplot(b$latencies, aes(x = elapsed)) +
facet_grid(. ~ op) +
labs(x = "Elapsed Secs", y = "Latency (ms)")
# Plot median, mean and 95th percentiles
plot2 <- latency_plot + labs(title = "Mean, Median, and 95th Percentile Latency") +
geom_smooth(aes(y = median, color = "median"), size=0.5) +
geom_point(aes(y = median, color = "median"), size=2.0) +
geom_smooth(aes(y = mean, color = "mean"), size=0.5) +
geom_point(aes(y = mean, color = "mean"), size=2.0) +
geom_smooth(aes(y = X95th, color = "95th"), size=0.5) +
geom_point(aes(y = X95th, color = "95th"), size=2.0) +
scale_colour_manual("Percentile", values = c("#FF665F", "#009D91", "#FFA700"))
# scale_color_hue("Percentile",
# breaks = c("X95th", "mean", "median"),
# labels = c("95th", "Mean", "Median"))
# Plot 99th percentile
plot3 <- latency_plot + labs(title = "99th Percentile Latency") +
geom_smooth(aes(y = X99th, color = "99th"), size=0.5) +
geom_point(aes(y = X99th, color = "99th"), size=2.0) +
scale_colour_manual("Percentile", values = c("#FF665F", "#009D91"))
# scale_color_hue("Percentile",
# breaks = c("X99_9th","X99th" ),
# labels = c("99.9th", "99th"))
# Plot 99.9th percentile
plot4 <- latency_plot + labs(title = "99.9th Percentile Latency") +
geom_smooth(aes(y = X99_9th, color = "99.9th"), size=0.5) +
geom_point(aes(y = X99_9th, color = "99.9th"), size=2.0) +
scale_colour_manual("Percentile", values = c("#FF665F", "#009D91", "#FFA700"))
# Plot 100th percentile
plot5 <- latency_plot + labs(title = "Maximum Latency") +
geom_smooth(aes(y = max, color = "max"), size=0.5) +
geom_point(aes(y = max, color = "max"), size=2.0) +
scale_colour_manual("Percentile", values = c("#FF665F", "#009D91", "#FFA700"))
grid.newpage()
pushViewport(viewport(layout = grid.layout(5, 1)))
vplayout <- function(x,y) viewport(layout.pos.row = x, layout.pos.col = y)
print(plot1, vp = vplayout(1,1))
print(plot2, vp = vplayout(2,1))
print(plot3, vp = vplayout(3,1))
print(plot4, vp = vplayout(4,1))
print(plot5, vp = vplayout(5,1))
dev.off()