diff options
author | 2016-03-07 20:00:50 -0800 | |
---|---|---|
committer | 2016-03-07 20:00:50 -0800 | |
commit | 710d58cfae07c1815cc4791977069beb47aedf78 (patch) | |
tree | d395cb0a28f47e700cf1fbc5972de40954534d8c /test/cpp/qps/qps_worker.cc | |
parent | dba948569a90fa12b4d024555e559c1abfc75607 (diff) |
Disable profiling in qps_worker for now
Diffstat (limited to 'test/cpp/qps/qps_worker.cc')
-rw-r--r-- | test/cpp/qps/qps_worker.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index 9442017ddf..ce4b773d92 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -101,6 +101,19 @@ static std::unique_ptr<Server> CreateServer(const ServerConfig& config) { abort(); } +class ScopedProfile GRPC_FINAL { + public: + ScopedProfile(const char *filename, bool enable) : enable_(enable) { + if (enable_) grpc_profiler_start(filename); + } + ~ScopedProfile() { + if (enable_) grpc_profiler_stop(); + } + + private: + const bool enable_; +}; + class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { public: WorkerServiceImpl(int server_port, QpsWorker* worker) @@ -114,9 +127,8 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { return Status(StatusCode::RESOURCE_EXHAUSTED, ""); } - grpc_profiler_start("qps_client.prof"); + ScopedProfile profile("qps_client.prof", false); Status ret = RunClientBody(ctx, stream); - grpc_profiler_stop(); return ret; } @@ -128,9 +140,8 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { return Status(StatusCode::RESOURCE_EXHAUSTED, ""); } - grpc_profiler_start("qps_server.prof"); + ScopedProfile profile("qps_server.prof", false); Status ret = RunServerBody(ctx, stream); - grpc_profiler_stop(); return ret; } |