aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/cpp/microbenchmarks/fullstack_fixtures.h14
-rw-r--r--test/cpp/microbenchmarks/helpers.cc3
-rw-r--r--test/cpp/microbenchmarks/helpers.h3
-rw-r--r--test/cpp/qps/client.h3
-rw-r--r--test/cpp/qps/client_async.cc18
-rw-r--r--test/cpp/qps/driver.cc12
-rw-r--r--test/cpp/qps/server.h3
-rw-r--r--test/cpp/qps/server_async.cc5
8 files changed, 37 insertions, 24 deletions
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h
index cb96ac5d71..b3ea12cb7a 100644
--- a/test/cpp/microbenchmarks/fullstack_fixtures.h
+++ b/test/cpp/microbenchmarks/fullstack_fixtures.h
@@ -100,10 +100,12 @@ class FullstackFixture : public BaseFixture {
}
}
- void Finish(benchmark::State &state) {
+ void Finish(benchmark::State& state) {
std::ostringstream out;
AddToLabel(out, state);
- AppendToLabel(out, "polls/iter", (double)grpc_get_cq_poll_num(this->cq()->cq())/state.iterations());
+ AppendToLabel(
+ out, "polls/iter",
+ (double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations());
auto label = out.str();
if (label.length() && label[0] == ' ') {
label = label.substr(1);
@@ -223,17 +225,19 @@ class EndpointPairFixture : public BaseFixture {
}
}
- void Finish(benchmark::State &state) {
+ void Finish(benchmark::State& state) {
std::ostringstream out;
AddToLabel(out, state);
- AppendToLabel(out, "polls/iter", (double)grpc_get_cq_poll_num(this->cq()->cq())/state.iterations());
+ AppendToLabel(
+ out, "polls/iter",
+ (double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations());
auto label = out.str();
if (label.length() && label[0] == ' ') {
label = label.substr(1);
}
state.SetLabel(label);
}
-
+
ServerCompletionQueue* cq() { return cq_.get(); }
std::shared_ptr<Channel> channel() { return channel_; }
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc
index 3bf67c3c01..76ae055803 100644
--- a/test/cpp/microbenchmarks/helpers.cc
+++ b/test/cpp/microbenchmarks/helpers.cc
@@ -68,6 +68,7 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) {
#endif
}
-void TrackCounters::AppendToLabel(std::ostream& out, std::string metric, double value) {
+void TrackCounters::AppendToLabel(std::ostream &out, std::string metric,
+ double value) {
out << " " << key << ":" << value;
}
diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h
index d2402a2d96..47dda4d4b2 100644
--- a/test/cpp/microbenchmarks/helpers.h
+++ b/test/cpp/microbenchmarks/helpers.h
@@ -80,7 +80,8 @@ class TrackCounters {
public:
virtual void Finish(benchmark::State& state);
virtual void AddToLabel(std::ostream& out, benchmark::State& state);
- virtual void AppendToLabel(std::ostream& out, std::string metric, double value);
+ virtual void AppendToLabel(std::ostream& out, std::string metric,
+ double value);
private:
#ifdef GPR_LOW_LEVEL_COUNTERS
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 92c6c7a3a3..173f5ab0c4 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -198,7 +198,8 @@ class Client {
stats.set_time_elapsed(timer_result.wall);
stats.set_time_system(timer_result.system);
stats.set_time_user(timer_result.user);
- gpr_log(GPR_INFO, "*****poll count : %d %d %d", GetPollCount(), last_reset_poll_count_, last_reset_poll_count_to_use);
+ gpr_log(GPR_INFO, "*****poll count : %d %d %d", GetPollCount(),
+ last_reset_poll_count_, last_reset_poll_count_to_use);
stats.set_cq_poll_count(GetPollCount() - last_reset_poll_count_to_use);
return stats;
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 2e4b7acba7..49f9b5ca40 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -209,16 +209,16 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
}
}
-int GetPollCount() {
- int count = 0;
- int i = 0;
- for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
- int k = (int)grpc_get_cq_poll_num((*cq)->cq());
- gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k);
- count += k;
+ int GetPollCount() {
+ int count = 0;
+ // int i = 0;
+ for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
+ int k = (int)grpc_get_cq_poll_num((*cq)->cq());
+ // gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k);
+ count += k;
+ }
+ return count;
}
- return count;
-}
protected:
const int num_async_threads_;
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 24e9f730af..c41dcaa914 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -182,10 +182,14 @@ static void postprocess_scenario_result(ScenarioResult* result) {
result->mutable_summary()->set_failed_requests_per_second(failures /
time_estimate);
}
- gpr_log(GPR_INFO, "client poll count : %f", sum(result->client_stats(), CliPollCount));
- result->mutable_summary()->set_client_polls_per_request(sum(result->client_stats(), CliPollCount)/histogram.Count());
- gpr_log(GPR_INFO, "server poll count : %f", sum(result->server_stats(), SvrPollCount));
- result->mutable_summary()->set_server_polls_per_request(sum(result->server_stats(), SvrPollCount)/histogram.Count());
+ gpr_log(GPR_INFO, "client poll count : %f",
+ sum(result->client_stats(), CliPollCount));
+ result->mutable_summary()->set_client_polls_per_request(
+ sum(result->client_stats(), CliPollCount) / histogram.Count());
+ gpr_log(GPR_INFO, "server poll count : %f",
+ sum(result->server_stats(), SvrPollCount));
+ result->mutable_summary()->set_server_polls_per_request(
+ sum(result->server_stats(), SvrPollCount) / histogram.Count());
}
std::unique_ptr<ScenarioResult> RunScenario(
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index 5d5d5ffe09..e9951564cb 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -49,7 +49,8 @@ namespace testing {
class Server {
public:
- explicit Server(const ServerConfig& config) : timer_(new UsageTimer), last_reset_poll_count_(0) {
+ explicit Server(const ServerConfig& config)
+ : timer_(new UsageTimer), last_reset_poll_count_(0) {
cores_ = gpr_cpu_num_cores();
if (config.port()) {
port_ = config.port();
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index e503e62204..4bd7af3d2d 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -160,14 +160,15 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
int GetPollCount() {
int count = 0;
- int i = 0;
+ // int i = 0;
for (auto cq = srv_cqs_.begin(); cq != srv_cqs_.end(); cq++) {
int k = (int)grpc_get_cq_poll_num((*cq)->cq());
- gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k);
+ // gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k);
count += k;
}
return count;
}
+
private:
void ShutdownThreadFunc() {
// TODO (vpai): Remove this deadline and allow Shutdown to finish properly