aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/driver.cc
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-08-25 08:18:25 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-08-25 08:18:25 -0700
commitf03b112d12d32f42b023a5c49d994438dde0a95e (patch)
tree979d4e64ecf7ed31495d635ea4caa7c037284f72 /test/cpp/qps/driver.cc
parent7187ab9866f95181212cdb8b80fcbe0a36b01765 (diff)
parent19ea0cffd7ba3df686ed05671f9ed35b8e9fa830 (diff)
Merge remote-tracking branch 'upstream/master' into cq_verifier_file_line
Diffstat (limited to 'test/cpp/qps/driver.cc')
-rw-r--r--test/cpp/qps/driver.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 2aeaea51f2..93f9271553 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -310,6 +310,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
// clients is array rather than std::vector to avoid gcc-4.4 issues
// where class contained in std::vector must have a copy constructor
auto* clients = new ClientData[num_clients];
+ size_t channels_allocated = 0;
for (size_t i = 0; i < num_clients; i++) {
const auto& worker = workers[i + num_servers];
gpr_log(GPR_INFO, "Starting client on %s (worker #%" PRIuPTR ")",
@@ -345,6 +346,16 @@ std::unique_ptr<ScenarioResult> RunScenario(
}
}
+ // Reduce channel count so that total channels specified is held regardless
+ // of the number of clients available
+ size_t num_channels =
+ (client_config.client_channels() - channels_allocated) /
+ (num_clients - i);
+ channels_allocated += num_channels;
+ gpr_log(GPR_DEBUG, "Client %" PRIdPTR " gets %" PRIdPTR " channels", i,
+ num_channels);
+ per_client_config.set_client_channels(num_channels);
+
ClientArgs args;
*args.mutable_setup() = per_client_config;
clients[i].stream =