diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-03-25 01:12:51 +0200 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-03-28 03:18:44 +0300 |
commit | 642baf4699c3a973c073403a7f1a4c85e0197e81 (patch) | |
tree | 6808479d9a86c9b2c9351d28d91d476936c1e751 /benchmark/common.js | |
parent | 66e7dc558705edb0f473c4df902e9e407a2896c4 (diff) | |
download | android-node-v8-642baf4699c3a973c073403a7f1a4c85e0197e81.tar.gz android-node-v8-642baf4699c3a973c073403a7f1a4c85e0197e81.tar.bz2 android-node-v8-642baf4699c3a973c073403a7f1a4c85e0197e81.zip |
benchmark: check end() argument to be > 0
PR-URL: https://github.com/nodejs/node/pull/12030
Ref: https://github.com/nodejs/node/issues/11972
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'benchmark/common.js')
-rw-r--r-- | benchmark/common.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/benchmark/common.js b/benchmark/common.js index 24369f2f54..77ebe0bd1d 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -193,6 +193,9 @@ Benchmark.prototype.end = function(operations) { if (typeof operations !== 'number') { throw new Error('called end() without specifying operation count'); } + if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED && operations <= 0) { + throw new Error('called end() with operation count <= 0'); + } const time = elapsed[0] + elapsed[1] / 1e9; const rate = operations / time; |