forked from gschaden/bonnieviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bonnieviewer.html
218 lines (201 loc) · 7.5 KB
/
bonnieviewer.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
<html>
<head>
<title>bonnie2gchart</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="csvjson.min.js"></script>
<script type="text/javascript">
var types = {
'blockio' : {
'name' : 'Block IO',
'title' : 'kB/sec (higher is better}',
'types' : ['outblk', 'outrw', 'inblk']
},
'metadata' : {
'name' : 'File metadata',
'title' : 'files/sec (higher is better}',
'types' : ['sc', 'sd', 'rc', 'rd']
},
'metadata-read' : {
'name' : 'File metadata (read}',
'title' : 'files/sec (higher is better}',
'types' : ['sr', 'rr']
},
'blockio-cpu' : {
'name' : 'Block IO CPU',
'title' : 'CPU usage in % (lower is better}',
'types' : ['outblkcpu', 'outrwcpu', 'inblkcpu', 'seekcpu']
},
'metadata-cpu' : {
'name' : 'Seq and Random CPU',
'title' : 'CPU usage in % (lower is better}',
'types' : ['sccpu', 'srcpu', 'sdcpu', 'rccpu', 'rrcpu', 'rdcpu']
},
'blockio-latency' : {
'name' : 'Block IO Latency',
'title' : 'milliseconds (lower is better}',
'types' : ['latoutblk', 'latoutrw', 'latinblk']
},
'metadata-latency' : {
'name' : 'File metadata Latency',
'title' : 'milliseconds (lower is better}',
'types' : ['latsc', 'latsd', 'latrc', 'latrd']
},
'metadata-read-latency' : {
'name' : 'File metadata (read} Latency',
'title' : 'milliseconds (lower is better}',
'types' : ['latsr', 'latrr']
}
};
var labels = {
'vera' : 'Version',
'verb' : 'Version',
'name' : 'Name',
'conc' : 'Concurrency',
'stz' : 'Unknown stz',
'sz' : 'Size',
'tta' : 'Empty tta',
'outch' : 'Seq Char Output',
'outchcpu' : 'Seq Char Output CPU',
'outblk' : 'Seq Block Output',
'outblkcpu' : 'Seq Block Output CPU',
'outrw' : 'Block Rewrite',
'outrwcpu' : 'Block Rewrite CPU',
'inch' : 'Char Input',
'inchcpu' : 'Char Input CPU',
'inblk' : 'Block Input',
'inblkcpu' : 'Block Input CPU',
'seek' : 'Random Seek',
'seekcpu' : 'Random Seek CPU',
'ttb' : 'Empty ttb',
'ttc' : 'Empty ttc',
'ttd' : 'Empty ttd',
'tte' : 'Empty tte',
'ttf' : 'Empty ttf',
'sc' : 'Seq Create',
'sccpu' : 'Seq Create CPU',
'sr' : 'Seq Read',
'srcpu' : 'Seq Read',
'sd' : 'Seq Delete',
'sdcpu' : 'Seq Delete CPU',
'rc' : 'Random Create',
'rccpu' : 'Random Create CPU',
'rr' : 'Random Read',
'rrcpu' : 'Random Read CPU',
'rd' : 'Random Delete',
'rdcpu' : 'Random Delete CPU',
'latoutch' : 'Latency Char Output',
'latoutblk' : 'Latency Block Output',
'latoutrw' : 'Latency Rewrite',
'latinch' : 'Latency Input Char',
'latinblk' : 'Latency Input Block',
'latrand' : 'Latency Random seek',
'latsc' : 'Latency Seq Create',
'latsr' : 'Latency Seq Read',
'latsd' : 'Latency Seq Delete',
'latrc' : 'Latency Random Create',
'latrr' : 'Latency Random Read',
'latrd' : 'Latency Random Delete',
};
</script>
</head>
<body>
<h2>Bonnie++ result viewer</h2>
<h4>
Paste the output of bonnie++ into the textarea, do not remove the header
<h4>
<textarea style="width: 100%; height: 300px;" id="data">vera,verb,name,conc,stz,sz,tta,outch,outchcpu,outblk,outblkcpu,outrw,outrwcpu,inch,inchcpu,inblk,inblkcpu,seek,seekcpu,ttb,ttc,ttd,tte,ttf,sc,sccpu,sr,srcpu,sd,sdcpu,rc,rccpu,rr,rrcpu,rd,rdcpu,latoutch,latoutblk,latoutrw,latinch,latinblk,latrand,latsc,latsr,latsd,latrc,latrr,latrd
1.96,1.96,test1,1,1397851636,4G,,845,96,172398,20,49107,6,3602,98,175250,10,1741,31,16,,,,,+++++,+++,+++++,+++,+++++,+++,+++++,+++,+++++,+++,+++++,+++,16308us,388ms,6347ms,7897us,334ms,17916us,9842us,594us,705us,227us,139us,233us
1.96,1.96,test2,1,1397860444,15744M,,429,99,163763,33,62026,14,1403,84,213616,24,566.6,30,16,,,,,24457,58,+++++,+++,+++++,+++,+++++,+++,+++++,+++,+++++,+++,20138us,669ms,188ms,340ms,118ms,226ms,5784us,531us,1111us,138us,43us,74us
</textarea>
<button onclick="javascript:drawCharts();">redraw</button>
<button onclick="javascript:makeURL();">make url</button><div id="newurl"></div>
<script type="text/javascript">
var regex1 = RegExp(/^(\d+)([mu]s)$/);
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawCharts);
function getParameterByName(name) { // Parse URL parameters
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var url_param = getParameterByName('data');
if (url_param)
document.getElementById("data").value = "vera,verb,name,conc,stz,sz,tta,outch,outchcpu,outblk,outblkcpu,outrw,outrwcpu,inch,inchcpu,inblk,inblkcpu,seek,seekcpu,ttb,ttc,ttd,tte,ttf,sc,sccpu,sr,srcpu,sd,sdcpu,rc,rccpu,rr,rrcpu,rd,rdcpu,latoutch,latoutblk,latoutrw,latinch,latinblk,latrand,latsc,latsr,latsd,latrc,latrr,latrd\n"
+url_param.replace(/\:/g, "+"); // convert : to +
function makeURL() {
var input = document.getElementById("data").value.replace(/\r\n/g, "\n").split("\n");
var input_len = input.length;
var output = "";
for (var k = 1; k < input_len; k++)
output += input[k].replace(/\+/g, ":") + '\n'; // convert + to :
output = window.location.href.split('?')[0] + '?data=' + encodeURI(output);
var newlink = 'new link';
document.getElementById('newurl').innerHTML = newlink.link(output);
}
function drawChart(d, t, container) {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Tests');
//build data table
var titles = types[t].types;
var cols = {};
for (var j = 0; j < titles.length; j++)
cols[titles[j]] = [labels[titles[j]]];
for (var i = 0; i < d.rows.length; i++){
data.addColumn('number', d.rows[i]["name"])
for (var j = 0; j < titles.length; j++){
// read input data
val = d.rows[i][titles[j]];
if (val == '')
val = undefined;
if (val.length > 0 && val[0] == '+')
val = undefined;
r = regex1.exec(val);
if (r){
if (r[2] == 'ms')
val = parseInt(r[1]);
else if (r[2] == 'us')
val = parseInt(r[1]) / 1000;
else if (r[2] == 'ns')
val = parseInt(r[1]) / 1000000;
else
val = parseInt(r[1]);
}
//console.log(val);
cols[titles[j]].push(val);
}
}
for (var j = 0; j < titles.length; j++)
data.addRows([cols[titles[j]]]);
var options = {
title: types[t].title,
vAxis: {title: types[t].name, titleTextStyle: {color: 'red'}}
};
container.innerHTML = container.innerHTML + '<div id="chart_div_'+t+'" style="float:left;width: 600px; height: 300px;"></div>';
chart = new google.visualization.BarChart(document.getElementById('chart_div_'+t));
chart.draw(data, options);
}
function drawCharts() {
var input = document.getElementById("data").value;
var d = csvjson.csv2json(input, {
delim: ",",
textdelim: "\""
});
//console.log("Converted CSV to JSON:", d);
var container = document.getElementById('charts');
container.innerHTML = "";
for (var key in types) {
if (types.hasOwnProperty(key)) {
//console.log(key + " -> " + types[key]);
drawChart(d, key, container);
}
}
}
</script>
<div id="charts">
</div>
<div style="clear:both">
<hr>
gschaden (at) gmail.com
</div>
</body>
</html>