diff options
Diffstat (limited to 'modules-available/vmstore/templates/benchmark-result.html')
-rw-r--r-- | modules-available/vmstore/templates/benchmark-result.html | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/modules-available/vmstore/templates/benchmark-result.html b/modules-available/vmstore/templates/benchmark-result.html new file mode 100644 index 00000000..fc7f8a55 --- /dev/null +++ b/modules-available/vmstore/templates/benchmark-result.html @@ -0,0 +1,106 @@ +<h1>{{lang_benchmark}}</h1> + +<h2>{{lang_benchmarkResult}}</h2> + +{{#remaining}} +<div class="alert alert-info"> + {{lang_benchmarkSecondsReminaing}}: {{remaining}} +</div> +{{/remaining}} + +<div id="graphs"></div> + +<script> + {{#refresh}} + setTimeout(function() { + window.location.reload(); + }, {{refresh}} * 1000); + {{/refresh}} + + document.addEventListener('DOMContentLoaded', function() { + var result = {{{result}}}; + var clients = {{{wanted}}}; + var graphs = {}; + function formatBytes(val) { + return Math.floor(val / 1024 / 1024) + "MB/s"; + } + function renderX(val, index) { + return Math.floor(val / 1000) + 's'; + } + function makeGraph(typeKey, resourceKey, caption) { + var uuid; + var ds = []; + var gmin = 0, lmax = 0; + var colors = []; + var cnt = 0; + for (uuid in result) { + if (gmin === 0 || result[uuid][typeKey].start < gmin) { + gmin = result[uuid][typeKey].start; + } + cnt++; + } + if (cnt === 1) { + colors.push('rgb(0, 128, 0)'); + } else { + for (i = 0; i < cnt; ++i) { + colors.push('rgb(0, 128, ' + (i / (cnt - 1)) * 255 + ')'); + } + } + var v, i, o, idx; + var sums = []; + for (uuid in result) { + o = result[uuid][typeKey].start - gmin; // Adjust according to earliest client + v = result[uuid][typeKey].values[resourceKey]; + for (i = 0; i < v.length; ++i) { + v[i].x += o; + if (cnt > 1) { + idx = (v[i].x / 250) | 0; + if (sums[idx]) { + sums[idx] += v[i].y | 0; + } else { + sums[idx] = v[i].y | 0; + } + } + } + if (v[v.length-1].x > lmax) lmax = v[v.length-1].x; // Get max value + ds.push({data: v, label: result[uuid].name, borderColor: colors[ds.length], fill: false}); + } + if (cnt > 1) { + ds.push({data: sums, label: 'Sum', borderColor: '#c00'}); + } + if (!graphs[typeKey]) { + var $e = $('#graphs'); + var $c = $('<canvas style="width:100%;height:250px">'); + $e.append($('<h3>').text(caption)); + $e.append($c); + var ls = []; + for (i = 0; i <= lmax; i += 250) ls.push(i); // Generate steps for graph + graphs[typeKey] = new Chart($c[0].getContext('2d'), {data: {datasets: ds, labels: ls}, type: 'scatter', options: { + animation: false, + responsive: true, + spanGaps: true, + borderWidth: 2, + pointBorderWidth: 0, + showLine: true, + scales: { y: { ticks: { callback: formatBytes }}, x: { ticks: { callback: renderX } } }, + plugins: { + tooltip: { callbacks: { label: function(context) { + if (context.parsed.y !== null) { + return context.dataset.label + ": " + formatBytes(context.parsed.y); + } + return context.dataset.label; + } + }}} + }}); + } else { + graphs[typeKey].data.datasets = ds; + graphs[typeKey].update(); + } + console.log(graphs[typeKey].data); + } + + makeGraph('SEQ', 'net', 'Sequential Reads'); + makeGraph('RND', 'net', 'Random 1M'); + + }); +</script>
\ No newline at end of file |