diff options
author | Craig Tiller <ctiller@google.com> | 2017-06-02 16:06:26 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-06-02 16:06:26 -0700 |
commit | c7717225af1d069b3e16b569f7956c2ea1ce0133 (patch) | |
tree | fca979e67fe32e2366f2d374ddbafb35f1bfd854 /src/node/performance/benchmark_client.js | |
parent | 0d8b98da1f04d643fcc1baa9be3acfb99cb3b09a (diff) | |
parent | 71005b169afbac8b5b84e76f86e87c2c0aae1af4 (diff) |
Merge branch 'ALL-the-things' of github.com:ctiller/grpc into ALL-the-things
Diffstat (limited to 'src/node/performance/benchmark_client.js')
-rw-r--r-- | src/node/performance/benchmark_client.js | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/src/node/performance/benchmark_client.js b/src/node/performance/benchmark_client.js index e7c426b2ff..e0e68ffdef 100644 --- a/src/node/performance/benchmark_client.js +++ b/src/node/performance/benchmark_client.js @@ -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; |