Skip to content

Commit

Permalink
benchmark: repair the fs/readfile benchmark
Browse files Browse the repository at this point in the history
PR-URL: #7818
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Sorin Baltateanu authored and MylesBorins committed Mar 28, 2017
1 parent ade64e6 commit 7aeeee3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion benchmark/fs/readfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
process.exit(0);
Expand All @@ -41,7 +43,8 @@ function main(conf) {
throw new Error('wrong number of bytes returned');

reads++;
read();
if (!bench_ended)
read();
}

var cur = +conf.concurrent;
Expand Down

0 comments on commit 7aeeee3

Please sign in to comment.