From 949729c06ec8e016d3ac9d123126bafdd5d9bd85 Mon Sep 17 00:00:00 2001 From: "kasperl@chromium.org" Date: Wed, 22 Oct 2008 11:55:08 +0000 Subject: [PATCH] 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 --- benchmarks/base.js | 18 +++++++++++++++++- benchmarks/run.html | 13 ++++++++++++- benchmarks/run.js | 14 ++++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/benchmarks/base.js b/benchmarks/base.js index f02398d..2c26132 100644 --- a/benchmarks/base.js +++ b/benchmarks/base.js @@ -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(); diff --git a/benchmarks/run.html b/benchmarks/run.html index 2d49dbc..41e4f78 100644 --- a/benchmarks/run.html +++ b/benchmarks/run.html @@ -63,6 +63,8 @@ div.run {