aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/driver.cc
diff options
context:
space:
mode:
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 =