From 1a41194a814a3978dadc2c03805ab9bef9ae1f78 Mon Sep 17 00:00:00 2001 From: Sorin Baltateanu Date: Thu, 21 Jul 2016 14:08:28 +0300 Subject: [PATCH] benchmark: Repair the fs/readfile benchmark Signed-off-by: Sorin Baltateanu --- benchmark/fs/readfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index cdb36d065f1c8f..1992a1c521a889 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -22,8 +22,10 @@ function main(conf) { data = null; var reads = 0; + var bench_ended = false; bench.start(); setTimeout(function() { + bench_ended = true; bench.end(reads); try { fs.unlinkSync(filename); } catch (e) {} }, +conf.dur * 1000); @@ -40,7 +42,8 @@ function main(conf) { throw new Error('wrong number of bytes returned'); reads++; - read(); + if (!bench_ended) + read(); } var cur = +conf.concurrent;