Author: [EMAIL PROTECTED] Date: Wed Oct 22 04:55:08 2008 New Revision: 553
Modified: branches/bleeding_edge/benchmarks/base.js branches/bleeding_edge/benchmarks/run.html branches/bleeding_edge/benchmarks/run.js Log: Improve error reporting in benchmarks. Review URL: http://codereview.chromium.org/8053 Modified: branches/bleeding_edge/benchmarks/base.js ============================================================================== --- branches/bleeding_edge/benchmarks/base.js (original) +++ branches/bleeding_edge/benchmarks/base.js Wed Oct 22 04:55:08 2008 @@ -169,6 +169,17 @@ } +// 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 @@ 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(); Modified: branches/bleeding_edge/benchmarks/run.html ============================================================================== --- branches/bleeding_edge/benchmarks/run.html (original) +++ branches/bleeding_edge/benchmarks/run.html Wed Oct 22 04:55:08 2008 @@ -63,6 +63,8 @@ <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 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 }); } Modified: branches/bleeding_edge/benchmarks/run.js ============================================================================== --- branches/bleeding_edge/benchmarks/run.js (original) +++ branches/bleeding_edge/benchmarks/run.js Wed Oct 22 04:55:08 2008 @@ -33,17 +33,27 @@ 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 }); --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---