Some improvements for benchmark view
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="benchmark.css">
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<script type='text/javascript' src="common.js"></script>
|
||||
<script type='text/javascript' src="benchmark.js"></script>
|
||||
</head>
|
||||
|
||||
|
||||
+43
-16
@@ -27,12 +27,20 @@ Object.values = function(obj) {
|
||||
return Object.keys(obj).map(function(key) { return obj[key]; });
|
||||
};
|
||||
|
||||
function getParameterByName(name) {
|
||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||
results = regex.exec(location.search);
|
||||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
Object.sum = function(obj) {
|
||||
return Object.values(obj).sum();
|
||||
};
|
||||
|
||||
Object.maxKey = function(obj) {
|
||||
var key, val = -Infinity;
|
||||
for (var p in obj) {
|
||||
if (val < obj[p]) {
|
||||
key = p;
|
||||
val = obj[p];
|
||||
}
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
function wrapTooltip(content) {
|
||||
return '<div style="padding: 0.5em; font-family: consolas; line-height: 1.5em;">' + content + '</div>';
|
||||
@@ -60,7 +68,7 @@ var link_code = {
|
||||
'jerryscript': 'https://github.com/Samsung/jerryscript/commit/',
|
||||
'duktape': 'https://github.com/svaarala/duktape/commit/'
|
||||
};
|
||||
var beginDate = new Date('2015-07-10');
|
||||
var beginDate = new Date('2015-07-11');
|
||||
|
||||
var benchmarkData = {};
|
||||
|
||||
@@ -100,20 +108,27 @@ $(document).ajaxStop(function () {
|
||||
transData[date] = [];
|
||||
transInfo[date] = element['info'];
|
||||
engines.forEach(function(engine, index) {
|
||||
var repVal = undefined; // default value
|
||||
var sum = undefined; // default value
|
||||
var max = undefined; // default value
|
||||
var maxTest = ''; // default value
|
||||
var numTests = 0;
|
||||
var benchmark_obj = element[benchmark];
|
||||
if (benchmark_obj) {
|
||||
var record = benchmark_obj[measureType][engine];
|
||||
if (record) {
|
||||
// record object contains a lot of subtests,
|
||||
// we use sum of all values as representative value
|
||||
var values = Object.values(record);
|
||||
repVal = isSum ? values.sum() : values.max();
|
||||
numTests = values.length;
|
||||
sum = Object.sum(record);
|
||||
maxTest = Object.maxKey(record);
|
||||
max = record[maxTest];
|
||||
numTests = Object.values(record).length;
|
||||
}
|
||||
}
|
||||
transData[date][index] = {tests: numTests, score: repVal};
|
||||
transData[date][index] = {
|
||||
tests: numTests,
|
||||
sum: sum,
|
||||
max: max,
|
||||
maxTest: maxTest,
|
||||
score: isSum ? sum : max
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -133,16 +148,28 @@ $(document).ajaxStop(function () {
|
||||
var engine_pure = engine.split('-')[0];
|
||||
var info = transInfo[date] ? transInfo[date][engine_pure] : undefined;
|
||||
var score = value.score ? value.score.toFixed(2) + measureUnits[measureType] : '';
|
||||
var tests = value.tests ? value.tests : 0;
|
||||
var tests = value.tests || 0;
|
||||
var max_test = value.maxTest || '';
|
||||
|
||||
var info_text = '';
|
||||
if (info && info.version)
|
||||
info_text = wrapHyperlink(link_code[engine_pure] + info.version, info.version);
|
||||
var engine_text = wrapHyperlink(link_main[engine_pure], engine);
|
||||
var score_text = score;
|
||||
if (isSum) {
|
||||
score_text += ' (' + tests + ' subtests)';
|
||||
}
|
||||
else {
|
||||
score_text += ' (' + max_test + ')';
|
||||
}
|
||||
score_text += ' ' + wrapHyperlink('details.html?' + $.param({date: date, engine: engine, benchmark:benchmark}), 'details');
|
||||
|
||||
var textData = [
|
||||
['source ', engine_text],
|
||||
['version ', info_text],
|
||||
['date ', date],
|
||||
['score ', score + ' (' + tests + ' subtests)']];
|
||||
['score ', score_text]];
|
||||
|
||||
return wrapTooltip(textData.map(function(v) { return v.join(': '); }).join('<br />'));
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
function getParameterByName(name) {
|
||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||
results = regex.exec(location.search);
|
||||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>jerryscript benchmark details</title>
|
||||
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<script type='text/javascript' src="common.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var src = getParameterByName('src') || 'data';
|
||||
var _date = getParameterByName('date');
|
||||
var engine = getParameterByName('engine');
|
||||
var benchmark = getParameterByName('benchmark');
|
||||
$.ajax({
|
||||
url: src + '/' + _date + '.json',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
// TODO pretty print? as a table?
|
||||
document.write('<h1>benchmark details</h1>');
|
||||
document.write('<p>' + _date + '</p>');
|
||||
document.write('<p>' + engine + '</p>');
|
||||
document.write('<p>' + benchmark + '</p>');
|
||||
document.write('<h3>memory</h3>');
|
||||
document.write('<pre>' + JSON.stringify(data[benchmark]['memory'][engine], null, 4) + '</pre>');
|
||||
document.write('<h3>performance</h3>');
|
||||
document.write('<pre>' + JSON.stringify(data[benchmark]['performance'][engine], null, 4) + '</pre>');
|
||||
},
|
||||
error: function(request, status, error) {
|
||||
document.write('error!');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user