diff options
Diffstat (limited to 'test/cpp/qps')
-rw-r--r-- | test/cpp/qps/server_async.cc | 1 | ||||
-rw-r--r-- | test/cpp/qps/server_sync.cc | 13 | ||||
-rw-r--r-- | test/cpp/qps/timer.cc | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 846f8f31b0..33b6fa55c3 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -45,7 +45,6 @@ #include <grpc/support/host_port.h> #include <grpc++/async_unary_call.h> #include <grpc++/config.h> -#include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index d90ff2212b..4c3c9cb497 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -40,6 +40,7 @@ #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc++/config.h> +#include <grpc++/dynamic_thread_pool.h> #include <grpc++/fixed_size_thread_pool.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> @@ -92,7 +93,13 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { class SynchronousServer GRPC_FINAL : public grpc::testing::Server { public: SynchronousServer(const ServerConfig& config, int port) - : thread_pool_(config.threads()), impl_(MakeImpl(port)) {} + : thread_pool_(), impl_(MakeImpl(port)) { + if (config.threads() > 0) { + thread_pool_.reset(new FixedSizeThreadPool(config.threads())); + } else { + thread_pool_.reset(new DynamicThreadPool(-config.threads())); + } + } private: std::unique_ptr<grpc::Server> MakeImpl(int port) { @@ -105,13 +112,13 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server { builder.RegisterService(&service_); - builder.SetThreadPool(&thread_pool_); + builder.SetThreadPool(thread_pool_.get()); return builder.BuildAndStart(); } TestServiceImpl service_; - FixedSizeThreadPool thread_pool_; + std::unique_ptr<ThreadPoolInterface> thread_pool_; std::unique_ptr<grpc::Server> impl_; }; diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc index 07289f699b..c1ba23decd 100644 --- a/test/cpp/qps/timer.cc +++ b/test/cpp/qps/timer.cc @@ -52,7 +52,7 @@ static double time_double(struct timeval* tv) { Timer::Result Timer::Sample() { struct rusage usage; struct timeval tv; - gettimeofday(&tv, nullptr); + gettimeofday(&tv, NULL); getrusage(RUSAGE_SELF, &usage); Result r; |