-
Notifications
You must be signed in to change notification settings - Fork 14
/
sysbench.html
273 lines (258 loc) · 8.61 KB
/
sysbench.html
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Copyright (C) 2011 Benoit Sigoure
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sysbench results</title>
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="https://raw.github.com/flot/flot/master/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="results.js"></script>
</head>
<body>
<a href="http://github.com/tsuna/sysbench-tools"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub"></a>
<table border="0" id="choices"><tr>
<td id="configs_list">Configs:</td>
<td id="test_modes_list">Test mode:</td>
<td>Metric:<table id="metric_table"></table></td>
</tr><tr>
<td><input type="checkbox" class="all" for="configs_list"> All</td>
<td><input type="checkbox" class="all" for="test_modes_list"> All</td>
<td><input type="checkbox" class="all" for="metric_table"> All</td>
</tr></table>
<div id="legend" style="display:none"></div>
<table id="graphs"></table>
<noscript>Sorry, JavaScript is required to view benchmark results. Nothing
evil and no stupid Flash, I promise.</noscript>
<script type="text/javascript">
function ucfirst(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
function init() {
function choice(id, label) {
return '<span><input type="checkbox" name="' + id + '" id="id' + id + '">'
+ '<label for="id' + id + '">' + label + '</label></span>';
}
// Populate the choices.
$("td").css("vertical-align", "top");
var list = $("#configs_list");
var configs = [];
var confignum = 0;
$.each(results, function (config, test2results) {
configs.push(config);
test2results["_color"] = confignum++;
});
configs.sort();
$.each(configs, function (_, config) {
id = config.replace(/[^-_a-z0-9]+/gi, "_");
label = ucfirst(config);
list.append("<br/>" + choice(id, label));
if (id != config) {
results[id] = results[config];
delete results[config];
}
results[id].label = label;
});
list = $("#test_modes_list");
$.each(TESTS, function (mode, descr) {
list.append("<br/>" + choice(mode, descr));
});
list = $("#metric_table");
var tr = $("<tr>");
list.append(tr);
var td = null;
var i = 0;
$.each(METRICS, function (metric, descr) {
if (i % 4 == 0) {
td = $("<td>");
tr.append(td);
}
td.append((i % 4 == 0 ? "" : "<br/>") + choice(metric, descr));
i++;
});
choices = $("#choices");
choices.find(".all").change(selectall);
choices.find("input").change(redraw);
choices.find(".all[for=configs_list]").click();
choices.find(".all[for=test_modes_list]").click();
$("#idthroughput").click();
$("#idiops").click();
$("#idreq_95p").click();
}
function selectall(event) {
var name = event.target.attributes["for"].value;
var checked = event.target.checked;
$("#" + name).find("input").attr("checked", checked);
}
function selected(what) {
var matched = [];
$(what).find("input:checked").each(function () {
matched.push($(this).attr("name"));
});
return matched;
}
var ONE_KB = 1024;
var ONE_MB = 1024 * ONE_KB;
var ONE_GB = 1024 * ONE_MB;
var ONE_TB = 1024 * ONE_GB;
function humanReadableBytes(n) {
var suffix = "";
if (n > ONE_TB) {
n = n / ONE_TB;
suffix = "T";
} else if (n > ONE_GB) {
n = n / ONE_GB;
suffix = "G";
} else if (n > ONE_MB) {
n = n / ONE_MB;
suffix = "M";
} else if (n > ONE_KB) {
n = n / ONE_KB;
suffix = "K";
}
return n.toFixed(1) + suffix + "B";
}
function prettyNumber(val, axis) {
if (val < 10) {
return val.toFixed(2);
} else if (val < 100) {
return val.toFixed(1);
}
return val.toFixed();
}
function redraw() {
var graphs = $("#graphs");
graphs.empty();
var test_modes = selected("#test_modes_list");
if (test_modes.length == 0) {
graphs.text("Pick a test mode.");
return;
}
var metrics = selected("#metric_table");
if (metrics.length == 0) {
graphs.text("Pick a metric.");
return;
}
var configs = {};
var hasconfig = false;
$("#configs_list").find("input").each(function () {
var config = $(this);
var checked = config.is(":checked");
configs[config.attr("name")] = checked;
config.parent().css("backgroundColor", "");
hasconfig |= checked;
});
if (!hasconfig) {
graphs.text("Pick a config.");
return;
}
$.each(test_modes, function (j, mode) {
var tr = $("<tr>");
graphs.append(tr);
$.each(metrics, function (i, metric) {
var td = $("<td>");
td.append($("<h3>").text(TESTS[mode] + ": " + METRICS[metric]));
tr.append(td);
var graph = $("<div>").css("width", "400px").css("height", "200px");
var lines = [];
$.each(results, function (config, test2results) {
if (!configs[config]
|| !test2results[mode]) {
return;
}
lines.push({"label": config,
"color": test2results["_color"],
"shadowSize": 0,
"data": test2results[mode]["averages"][metric],
// Custom field
"benchmark": {
"config": config,
"mode": mode,
"metric": metric,
},
});
});
td.append(graph);
var graph_params = {"yaxis": {"min": 0, "tickFormatter": prettyNumber},
"series": {"lines": {"show": true},
"points": {"show": true}},
"grid": {"hoverable": true},
"legend": {"show": false}};
if (METRICS[metric].toLowerCase().indexOf("bytes") != -1
|| metric == "throughput") {
graph_params.yaxis.tickFormatter = humanReadableBytes;
}
var plot = $.plot(graph, lines, graph_params);
enableTooltip(graph);
// Copy legend color over.
var series = plot.getData();
$.each(results, function (config, test2results) {
var checkbox = $("#id" + config);
var color = undefined;
$.each(series, function (i, s) {
if (s.label == config) {
color = s.color;
}
});
checkbox.parent().css("backgroundColor", color);
});
});
});
}
function enableTooltip(graph) {
var curseries = null;
var curpoint = null;
graph.bind("plothover", function (event, pos, item) {
if (item && (curseries != item.seriesIndex
|| curpoint != item.dataIndex)) {
$("#tooltip").remove();
var series = item.series;
var bench = series.benchmark;
var x = item.datapoint[0];
var format = series.yaxis.tickFormatter;
var yaxis = series.yaxis;
var y = format(item.datapoint[1], yaxis);
var res = results[bench.config];
var values = res[bench.mode].results[bench.metric][x];
values = $.map(values, function (y, _) { return format(y, yaxis); });
showTooltip(item.pageX, item.pageY,
res.label + " with " + x + " threads = " + y
+ "<br/><small>(average of " + values.join(", ") + ")</small>");
curseries = item.seriesIndex;
curpoint = item.dataIndex;
} else if (!item) {
$("#tooltip").remove();
curpoint = null;
}
});
}
function showTooltip(x, y, contents) {
$("<div id=tooltip>" + contents + "</div>").css({
position: "absolute",
display: "none",
top: y + 5,
left: x + 5,
border: "1px solid #fdd",
padding: "2px",
"background-color": "#fee",
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
$(function () {
init();
redraw();
});
</script>
</body>
</html>