aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2018-06-07 22:17:14 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-06-14 14:58:09 -0400
commit58e0cbf9fb67186ee67be5bb71aba36e9cfebe7f (patch)
tree36a6e9fc3beb37ab4030d50375bebf7e6673c1a1 /test/cpp/qps
parent33b77eee7890b7e8a00b256eb501d476feae09db (diff)
Enable the performance-* clang-tidy checks
Diffstat (limited to 'test/cpp/qps')
-rw-r--r--test/cpp/qps/client_async.cc29
-rw-r--r--test/cpp/qps/client_sync.cc2
-rw-r--r--test/cpp/qps/driver.cc30
-rw-r--r--test/cpp/qps/qps_interarrival_test.cc3
-rw-r--r--test/cpp/qps/report.h2
-rw-r--r--test/cpp/qps/server_sync.cc2
6 files changed, 39 insertions, 29 deletions
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index c79a10d1b4..e6dbb7e076 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -24,6 +24,7 @@
#include <sstream>
#include <string>
#include <thread>
+#include <utility>
#include <vector>
#include <grpc/grpc.h>
@@ -78,7 +79,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
response_(),
next_state_(State::READY),
callback_(on_done),
- next_issue_(next_issue),
+ next_issue_(std::move(next_issue)),
prepare_req_(prepare_req) {}
~ClientRpcContextUnaryImpl() override {}
void Start(CompletionQueue* cq, const ClientConfig& config) override {
@@ -326,7 +327,7 @@ class AsyncUnaryClient final
std::function<gpr_timespec()> next_issue,
const SimpleRequest& req) {
return new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
- stub, req, next_issue, AsyncUnaryClient::PrepareReq,
+ stub, req, std::move(next_issue), AsyncUnaryClient::PrepareReq,
AsyncUnaryClient::CheckDone);
}
};
@@ -349,7 +350,7 @@ class ClientRpcContextStreamingPingPongImpl : public ClientRpcContext {
response_(),
next_state_(State::INVALID),
callback_(on_done),
- next_issue_(next_issue),
+ next_issue_(std::move(next_issue)),
prepare_req_(prepare_req),
coalesce_(false) {}
~ClientRpcContextStreamingPingPongImpl() override {}
@@ -510,7 +511,8 @@ class AsyncStreamingPingPongClient final
const SimpleRequest& req) {
return new ClientRpcContextStreamingPingPongImpl<SimpleRequest,
SimpleResponse>(
- stub, req, next_issue, AsyncStreamingPingPongClient::PrepareReq,
+ stub, req, std::move(next_issue),
+ AsyncStreamingPingPongClient::PrepareReq,
AsyncStreamingPingPongClient::CheckDone);
}
};
@@ -533,7 +535,7 @@ class ClientRpcContextStreamingFromClientImpl : public ClientRpcContext {
response_(),
next_state_(State::INVALID),
callback_(on_done),
- next_issue_(next_issue),
+ next_issue_(std::move(next_issue)),
prepare_req_(prepare_req) {}
~ClientRpcContextStreamingFromClientImpl() override {}
void Start(CompletionQueue* cq, const ClientConfig& config) override {
@@ -640,7 +642,8 @@ class AsyncStreamingFromClientClient final
const SimpleRequest& req) {
return new ClientRpcContextStreamingFromClientImpl<SimpleRequest,
SimpleResponse>(
- stub, req, next_issue, AsyncStreamingFromClientClient::PrepareReq,
+ stub, req, std::move(next_issue),
+ AsyncStreamingFromClientClient::PrepareReq,
AsyncStreamingFromClientClient::CheckDone);
}
};
@@ -663,7 +666,7 @@ class ClientRpcContextStreamingFromServerImpl : public ClientRpcContext {
response_(),
next_state_(State::INVALID),
callback_(on_done),
- next_issue_(next_issue),
+ next_issue_(std::move(next_issue)),
prepare_req_(prepare_req) {}
~ClientRpcContextStreamingFromServerImpl() override {}
void Start(CompletionQueue* cq, const ClientConfig& config) override {
@@ -754,7 +757,8 @@ class AsyncStreamingFromServerClient final
const SimpleRequest& req) {
return new ClientRpcContextStreamingFromServerImpl<SimpleRequest,
SimpleResponse>(
- stub, req, next_issue, AsyncStreamingFromServerClient::PrepareReq,
+ stub, req, std::move(next_issue),
+ AsyncStreamingFromServerClient::PrepareReq,
AsyncStreamingFromServerClient::CheckDone);
}
};
@@ -775,9 +779,9 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
req_(req),
response_(),
next_state_(State::INVALID),
- callback_(on_done),
- next_issue_(next_issue),
- prepare_req_(prepare_req) {}
+ callback_(std::move(on_done)),
+ next_issue_(std::move(next_issue)),
+ prepare_req_(std::move(prepare_req)) {}
~ClientRpcContextGenericStreamingImpl() override {}
void Start(CompletionQueue* cq, const ClientConfig& config) override {
GPR_ASSERT(!config.use_coalesce_api()); // not supported yet.
@@ -918,7 +922,8 @@ class GenericAsyncStreamingClient final
std::function<gpr_timespec()> next_issue,
const ByteBuffer& req) {
return new ClientRpcContextGenericStreamingImpl(
- stub, req, next_issue, GenericAsyncStreamingClient::PrepareReq,
+ stub, req, std::move(next_issue),
+ GenericAsyncStreamingClient::PrepareReq,
GenericAsyncStreamingClient::CheckDone);
}
};
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index e65e3b43f3..3a60c57e1d 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -192,7 +192,7 @@ class SynchronousStreamingClient : public SynchronousClient {
new (&context_[thread_idx]) ClientContext();
}
- void CleanupAllStreams(std::function<void(size_t)> cleaner) {
+ void CleanupAllStreams(const std::function<void(size_t)>& cleaner) {
std::vector<std::thread> cleanup_threads;
for (size_t i = 0; i < num_threads_; i++) {
cleanup_threads.emplace_back([this, i, cleaner] {
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 34f1291576..ecf5860b93 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -96,16 +96,20 @@ static deque<string> get_workers(const string& env_name) {
}
// helpers for postprocess_scenario_result
-static double WallTime(ClientStats s) { return s.time_elapsed(); }
-static double SystemTime(ClientStats s) { return s.time_system(); }
-static double UserTime(ClientStats s) { return s.time_user(); }
-static double CliPollCount(ClientStats s) { return s.cq_poll_count(); }
-static double SvrPollCount(ServerStats s) { return s.cq_poll_count(); }
-static double ServerWallTime(ServerStats s) { return s.time_elapsed(); }
-static double ServerSystemTime(ServerStats s) { return s.time_system(); }
-static double ServerUserTime(ServerStats s) { return s.time_user(); }
-static double ServerTotalCpuTime(ServerStats s) { return s.total_cpu_time(); }
-static double ServerIdleCpuTime(ServerStats s) { return s.idle_cpu_time(); }
+static double WallTime(const ClientStats& s) { return s.time_elapsed(); }
+static double SystemTime(const ClientStats& s) { return s.time_system(); }
+static double UserTime(const ClientStats& s) { return s.time_user(); }
+static double CliPollCount(const ClientStats& s) { return s.cq_poll_count(); }
+static double SvrPollCount(const ServerStats& s) { return s.cq_poll_count(); }
+static double ServerWallTime(const ServerStats& s) { return s.time_elapsed(); }
+static double ServerSystemTime(const ServerStats& s) { return s.time_system(); }
+static double ServerUserTime(const ServerStats& s) { return s.time_user(); }
+static double ServerTotalCpuTime(const ServerStats& s) {
+ return s.total_cpu_time();
+}
+static double ServerIdleCpuTime(const ServerStats& s) {
+ return s.idle_cpu_time();
+}
static int Cores(int n) { return n; }
// Postprocess ScenarioResult and populate result summary.
@@ -156,7 +160,7 @@ static void postprocess_scenario_result(ScenarioResult* result) {
int64_t successes = 0;
int64_t failures = 0;
for (int i = 0; i < result->request_results_size(); i++) {
- RequestResultCount rrc = result->request_results(i);
+ const RequestResultCount& rrc = result->request_results(i);
if (rrc.status_code() == 0) {
successes += rrc.count();
} else {
@@ -213,7 +217,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
// To be added to the result, containing the final configuration used for
// client and config (including host, etc.)
ClientConfig result_client_config;
- const ServerConfig result_server_config = initial_server_config;
+ const ServerConfig& result_server_config = initial_server_config;
// Get client, server lists; ignore if inproc test
auto workers = (!run_inproc) ? get_workers("QPS_WORKERS") : deque<string>();
@@ -280,7 +284,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
local_workers[i]->InProcessChannel(channel_args));
}
- ServerConfig server_config = initial_server_config;
+ const ServerConfig& server_config = initial_server_config;
if (server_config.core_limit() != 0) {
gpr_log(GPR_ERROR,
"server config core limit is set but ignored by driver");
diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc
index 625b7db426..2cc22e9985 100644
--- a/test/cpp/qps/qps_interarrival_test.cc
+++ b/test/cpp/qps/qps_interarrival_test.cc
@@ -28,7 +28,8 @@
using grpc::testing::InterarrivalTimer;
using grpc::testing::RandomDistInterface;
-static void RunTest(RandomDistInterface&& r, int threads, std::string title) {
+static void RunTest(RandomDistInterface&& r, int threads,
+ const std::string& title) {
InterarrivalTimer timer;
timer.init(r, threads);
grpc_histogram* h(grpc_histogram_create(0.01, 60e9));
diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h
index 8e62f4f449..b00b0a311f 100644
--- a/test/cpp/qps/report.h
+++ b/test/cpp/qps/report.h
@@ -129,7 +129,7 @@ class JsonReporter : public Reporter {
class RpcReporter : public Reporter {
public:
- RpcReporter(const string& name, std::shared_ptr<grpc::Channel> channel)
+ RpcReporter(const string& name, const std::shared_ptr<grpc::Channel>& channel)
: Reporter(name), stub_(ReportQpsScenarioService::NewStub(channel)) {}
private:
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 82a9186989..b8facf9b56 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -129,7 +129,7 @@ class BenchmarkServiceImpl final : public BenchmarkService::Service {
template <class W>
static Status ServerPush(ServerContext* context, W* stream,
const SimpleResponse& response,
- std::function<bool()> done) {
+ const std::function<bool()>& done) {
while ((done == nullptr) || !done()) {
// TODO(vjpai): Add potential for rate-pacing on this
if (!stream->Write(response)) {