}
if (runner.NotifyScore) {
var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores);
- runner.NotifyScore(Math.round(100 * score));
+ runner.NotifyScore(100 * score);
}
}
RunStep();
var score = this.reference / mean;
BenchmarkSuite.scores.push(score);
if (this.runner.NotifyResult) {
- this.runner.NotifyResult(this.name, Math.round(100 * score));
+ this.runner.NotifyResult(this.name, 100 * score);
}
}
}
return RunNext();
}
+
+
+// Converts a score value to a string with at least three significant
+// digits.
+function formatScore(value) {
+ if (value > 100) {
+ return value.toFixed(0);
+ } else {
+ return value.toPrecision(3);
+ }
+}
function AddResult(name, result) {
- var text = name + ': ' + result;
+ var text = name + ': ' + formatScore(result);
var results = document.getElementById("results");
results.innerHTML += (text + "<br/>");
}
function AddScore(score) {
var status = document.getElementById("status");
if (success) {
- status.innerHTML = "Score: " + score;
+ status.innerHTML = "Score: " + formatScore(score);
}
}
var success = true;
function PrintResult(name, result) {
- print(name + ': ' + result);
+ print(name + ': ' + formatScore(result));
}
function PrintScore(score) {
if (success) {
print('----');
- print('Score (version ' + BenchmarkSuite.version + '): ' + score);
+ print('Score (version ' + BenchmarkSuite.version + '): '
+ + formatScore(score));
}
}