Commit 949729c0 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Improve error reporting in benchmarks.

Review URL: http://codereview.chromium.org/8053

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@553 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8e9bdd7b
......@@ -169,6 +169,17 @@ BenchmarkSuite.prototype.NotifyResult = function() {
}
// Notifies the runner that running a benchmark resulted in an error.
BenchmarkSuite.prototype.NotifyError = function(error) {
if (this.runner.NotifyError) {
this.runner.NotifyError(this.name, error);
}
if (this.runner.NotifyStep) {
this.runner.NotifyStep(this.name);
}
}
// Runs a single benchmark for at least a second and computes the
// average time it takes to run a single iteration.
BenchmarkSuite.prototype.RunSingle = function(benchmark) {
......@@ -195,7 +206,12 @@ BenchmarkSuite.prototype.RunStep = function(runner) {
var suite = this;
function RunNext() {
if (index < length) {
suite.RunSingle(suite.benchmarks[index++]);
try {
suite.RunSingle(suite.benchmarks[index++]);
} catch (e) {
suite.NotifyError(e);
return null;
}
return RunNext;
}
suite.NotifyResult();
......
......@@ -63,6 +63,8 @@ div.run {
<script type="text/javascript">
var completed = 0;
var benchmarks = BenchmarkSuite.CountBenchmarks();
var success = true;
function ShowProgress(name) {
var status = document.getElementById("status");
var percentage = ((++completed) / benchmarks) * 100;
......@@ -77,14 +79,23 @@ function AddResult(name, result) {
}
function AddError(name, error) {
AddResult(name, '<b>error</b>');
success = false;
}
function AddScore(score) {
var status = document.getElementById("status");
status.innerHTML = "Score: " + score;
if (success) {
status.innerHTML = "Score: " + score;
}
}
function Run() {
BenchmarkSuite.RunSuites({ NotifyStep: ShowProgress,
NotifyError: AddError,
NotifyResult: AddResult,
NotifyScore: AddScore });
}
......
......@@ -33,17 +33,27 @@ load('crypto.js');
load('raytrace.js');
load('earley-boyer.js');
var success = true;
function PrintResult(name, result) {
print(name + ': ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
success = false;
}
function PrintScore(score) {
print('----');
print('Score (version ' + BenchmarkSuite.version + '): ' + score);
if (success) {
print('----');
print('Score (version ' + BenchmarkSuite.version + '): ' + score);
}
}
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError,
NotifyScore: PrintScore });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment