Merge pull request #11286 from murgatroid99/node_perf_tests

Enable more Node performance tests, fix streaming test implementation
This commit is contained in:
Michael Lumish 2017-06-02 10:35:18 -07:00 committed by GitHub
commit 7f3b754e0d

View File

@ -227,18 +227,22 @@ BenchmarkClient.prototype.startClosedLoop = function(
makeCall = function(client) {
if (self.running) {
self.pending_calls++;
var start_time = process.hrtime();
var call = client.streamingCall();
var start_time = process.hrtime();
call.write(argument);
call.on('data', function() {
});
call.on('end', function() {
var time_diff = process.hrtime(start_time);
self.histogram.add(timeDiffToNanos(time_diff));
makeCall(client);
self.pending_calls--;
if ((!self.running) && self.pending_calls == 0) {
self.emit('finished');
if (self.running) {
self.pending_calls++;
start_time = process.hrtime();
call.write(argument);
} else {
call.end();
if (self.pending_calls == 0) {
self.emit('finished');
}
}
});
call.on('error', function(error) {
@ -317,30 +321,8 @@ BenchmarkClient.prototype.startPoisson = function(
}
};
} else {
makeCall = function(client, poisson) {
if (self.running) {
self.pending_calls++;
var start_time = process.hrtime();
var call = client.streamingCall();
call.write(argument);
call.on('data', function() {
});
call.on('end', function() {
var time_diff = process.hrtime(start_time);
self.histogram.add(timeDiffToNanos(time_diff));
self.pending_calls--;
if ((!self.running) && self.pending_calls == 0) {
self.emit('finished');
}
});
call.on('error', function(error) {
self.emit('error', new Error('Client error: ' + error.message));
self.running = false;
});
} else {
poisson.stop();
}
};
self.emit('error', new Error('Streaming Poisson benchmarks not supported'));
return;
}
var averageIntervalMs = (1 / offered_load) * 1000;