diff options
author | 2016-02-01 09:46:30 -0800 | |
---|---|---|
committer | 2016-02-01 09:46:30 -0800 | |
commit | c5eec2be89bb201f84b7278da5522a205dc3620b (patch) | |
tree | 3f5abd7517039cde61b62395fafc584f5de14212 | |
parent | c64736d852991c734938a16d58cb5861b7014c07 (diff) |
Make dynamic sizing of async threads work again
-rw-r--r-- | test/cpp/qps/client.h | 3 | ||||
-rw-r--r-- | test/cpp/qps/client_async.cc | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 7d5f6466f9..50b2bf2514 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -324,7 +324,7 @@ class ClientImpl : public Client { std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)> create_stub) : channels_(config.client_channels()), create_stub_(create_stub) { - LimitCores(config.core_list().data(), config.core_list_size()); + cores_ = LimitCores(config.core_list().data(), config.core_list_size()); for (int i = 0; i < config.client_channels(); i++) { channels_[i].init(config.server_targets(i % config.server_targets_size()), @@ -337,6 +337,7 @@ class ClientImpl : public Client { virtual ~ClientImpl() {} protected: + int cores_; RequestType request_; class ClientChannelInfo { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 4229e1956e..f3f8f37051 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -159,6 +159,7 @@ class AsyncClient : public ClientImpl<StubType, RequestType> { using Client::SetupLoadTest; using Client::NextIssueTime; using Client::closed_loop_; + using ClientImpl<StubType, RequestType>::cores_; using ClientImpl<StubType, RequestType>::channels_; using ClientImpl<StubType, RequestType>::request_; AsyncClient(const ClientConfig& config, @@ -345,11 +346,11 @@ class AsyncClient : public ClientImpl<StubType, RequestType> { private: bool val_; }; - static int NumThreads(const ClientConfig& config) { + int NumThreads(const ClientConfig& config) { int num_threads = config.async_client_threads(); if (num_threads <= 0) { // Use dynamic sizing - num_threads = gpr_cpu_num_cores(); - gpr_log(GPR_INFO, "Sizing client server to %d threads", num_threads); + num_threads = cores_; + gpr_log(GPR_INFO, "Sizing async client to %d threads", num_threads); } return num_threads; } |