From dbd03b5e2d97f869089b2165edd2c419101b1c83 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 31 May 2016 13:00:33 -0700 Subject: Make client_channels be across all clients, not per-client --- test/cpp/qps/driver.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/cpp') diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 04b2b453f9..da47a985b8 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -306,6 +306,7 @@ std::unique_ptr 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 #%d)", worker.c_str(), @@ -341,6 +342,13 @@ std::unique_ptr RunScenario( } } + size_t num_channels = + (i == num_clients - 1) + ? channels_allocated - client_config.client_channels() + : client_config.client_channels() / num_clients; + channels_allocated += num_channels; + per_client_config.set_client_channels(num_channels); + ClientArgs args; *args.mutable_setup() = per_client_config; clients[i].stream = -- cgit v1.2.3 From 1adb13143f21a54a3e3d7018d0db4d15d78c1adc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 31 May 2016 13:04:32 -0700 Subject: Add comment --- test/cpp/qps/driver.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/cpp') diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index da47a985b8..147c540840 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -342,6 +342,8 @@ std::unique_ptr RunScenario( } } + // Reduce channel count so that total channels specified is held regardless + // of the number of clients available size_t num_channels = (i == num_clients - 1) ? channels_allocated - client_config.client_channels() -- cgit v1.2.3 From d4aa7cf5a502462debd4a42f0daf4c018c824263 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 31 May 2016 13:59:25 -0700 Subject: Fix negation --- test/cpp/qps/driver.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/cpp') diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 147c540840..298087dd36 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -346,9 +346,10 @@ std::unique_ptr RunScenario( // of the number of clients available size_t num_channels = (i == num_clients - 1) - ? channels_allocated - client_config.client_channels() + ? client_config.client_channels() - channels_allocated : client_config.client_channels() / num_clients; channels_allocated += num_channels; + gpr_log(GPR_DEBUG, "Client %d gets %d channels", i, num_channels); per_client_config.set_client_channels(num_channels); ClientArgs args; -- cgit v1.2.3 From 7e5d46496b6ad47aa84583260cf7886f7f51da5f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 22 Jun 2016 08:17:27 -0700 Subject: Better distribution --- test/cpp/qps/driver.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test/cpp') diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 147c540840..2efdc1288f 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -345,9 +345,7 @@ std::unique_ptr RunScenario( // Reduce channel count so that total channels specified is held regardless // of the number of clients available size_t num_channels = - (i == num_clients - 1) - ? channels_allocated - client_config.client_channels() - : client_config.client_channels() / num_clients; + (client_channels - channels_allocated) / (num_clients - i); channels_allocated += num_channels; per_client_config.set_client_channels(num_channels); -- cgit v1.2.3 From 5856dee7d6728bcdd0aaf8ac98abef4690252d4b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 22 Jun 2016 16:30:22 -0700 Subject: Fix compile --- test/cpp/qps/driver.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/cpp') diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 6b31225f20..b59c1efe12 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -31,6 +31,7 @@ * */ +#include #include #include #include @@ -345,9 +346,11 @@ std::unique_ptr RunScenario( // Reduce channel count so that total channels specified is held regardless // of the number of clients available size_t num_channels = - (client_channels - channels_allocated) / (num_clients - i); + (client_config.client_channels() - channels_allocated) / + (num_clients - i); channels_allocated += num_channels; - gpr_log(GPR_DEBUG, "Client %d gets %d channels", i, num_channels); + gpr_log(GPR_DEBUG, "Client %" PRIdPTR " gets %" PRIdPTR " channels", i, + num_channels); per_client_config.set_client_channels(num_channels); ClientArgs args; -- cgit v1.2.3