Skip to content

Commit

Permalink
benchmark: missing process.exit after bench.end
Browse files Browse the repository at this point in the history
Previously bench.end would call process.exit(0) however this is rather
confusing and indeed a few benchmarks had code that assumed otherwise.

This adds process.exit(0) to the benchmarks that needs it.

PR-URL: #7094
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
AndreasMadsen committed Jul 26, 2016
1 parent f99471b commit 8bb59fd
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions benchmark/dgram/array-vs-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function server() {
var bytes = sent * len;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
1 change: 1 addition & 0 deletions benchmark/dgram/multi-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function server() {
var bytes = (type === 'send' ? sent : received) * len;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
1 change: 1 addition & 0 deletions benchmark/dgram/offset-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function server() {
var bytes = (type === 'send' ? sent : received) * chunk.length;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
1 change: 1 addition & 0 deletions benchmark/dgram/single-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function server() {
var bytes = (type === 'send' ? sent : received) * chunk.length;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});

Expand Down
1 change: 1 addition & 0 deletions benchmark/fs/readfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function main(conf) {
setTimeout(function() {
bench.end(reads);
try { fs.unlinkSync(filename); } catch (e) {}
process.exit(0);
}, +conf.dur * 1000);

function read() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/http/_chunky_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function main(conf) {
count += 1;
if (count === num) {
bench.end(count);
process.exit(0);
} else {
WriteHTTPHeaders(socket, 1, min + size);
}
Expand Down
1 change: 1 addition & 0 deletions benchmark/http/client-request-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ function main(conf) {

function done() {
bench.end(nreqs);
process.exit(0);
}
}
1 change: 1 addition & 0 deletions benchmark/net/net-c2s-cork.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function server() {
var bytes = writer.received;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);

function send() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function server() {
var bytes = writer.received;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});
});
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function server() {
var bytes = writer.received * 2;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});
});
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function server() {
var bytes = writer.received;
var gbits = (bytes * 8) / (1024 * 1024 * 1024);
bench.end(gbits);
process.exit(0);
}, dur * 1000);
});
});
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-c2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function server() {
setTimeout(function() {
// report in Gb/sec
bench.end((bytes * 8) / (1024 * 1024 * 1024));
process.exit(0);
}, dur * 1000);

clientHandle.onread = function(nread, buffer) {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function client() {
// multiply by 2 since we're sending it first one way
// then then back again.
bench.end(2 * (bytes * 8) / (1024 * 1024 * 1024));
process.exit(0);
}, dur * 1000);

while (clientHandle.writeQueueSize === 0)
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/tcp-raw-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function client() {
setTimeout(function() {
// report in Gb/sec
bench.end((bytes * 8) / (1024 * 1024 * 1024));
process.exit(0);
}, dur * 1000);
};
}
1 change: 1 addition & 0 deletions benchmark/tls/tls-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ function done() {
// don't always match. Generally, serverConn will be
// the smaller number, but take the min just to be sure.
bench.end(Math.min(serverConn, clientConn));
process.exit(0);
}

0 comments on commit 8bb59fd

Please sign in to comment.