clean up, fix minor issue
diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c
index bfdd7f2..346ea18 100644
--- a/src/core/lib/surface/completion_queue.c
+++ b/src/core/lib/surface/completion_queue.c
@@ -227,7 +227,7 @@
/* TODO: sreek - This will no longer be needed. Use polling_type set */
int is_non_listening_server_cq;
int num_pluckers;
- gpr_atm num_poll;
+ gpr_atm num_polls;
plucker pluckers[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS];
grpc_closure pollset_shutdown_done;
@@ -293,7 +293,7 @@
cc->is_server_cq = 0;
cc->is_non_listening_server_cq = 0;
cc->num_pluckers = 0;
- gpr_atm_no_barrier_store(&cc->num_poll, 0);
+ gpr_atm_no_barrier_store(&cc->num_polls, 0);
gpr_atm_no_barrier_store(&cc->things_queued_ever, 0);
#ifndef NDEBUG
cc->outstanding_tag_count = 0;
@@ -311,7 +311,7 @@
}
gpr_atm grpc_get_cq_poll_num(grpc_completion_queue *cc) {
- return gpr_atm_no_barrier_load(&cc->num_poll);
+ return gpr_atm_no_barrier_load(&cc->num_polls);
}
#ifdef GRPC_CQ_REF_COUNT_DEBUG
@@ -598,7 +598,7 @@
gpr_mu_lock(cc->mu);
continue;
} else {
- cc->num_poll++;
+ gpr_atm_no_barrier_fetch_add(&cc->num_polls, 1);
grpc_error *err = cc->poller_vtable->work(&exec_ctx, POLLSET_FROM_CQ(cc),
NULL, now, iteration_deadline);
if (err != GRPC_ERROR_NONE) {
@@ -791,7 +791,7 @@
grpc_exec_ctx_flush(&exec_ctx);
gpr_mu_lock(cc->mu);
} else {
- gpr_atm_no_barrier_fetch_add(&cc->num_poll, 1);
+ gpr_atm_no_barrier_fetch_add(&cc->num_polls, 1);
grpc_error *err = cc->poller_vtable->work(
&exec_ctx, POLLSET_FROM_CQ(cc), &worker, now, iteration_deadline);
if (err != GRPC_ERROR_NONE) {
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 173f5ab..8006cac 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -163,7 +163,8 @@
MaybeStartRequests();
- int last_reset_poll_count_to_use = last_reset_poll_count_;
+ int cur_poll_count = GetPollCount();
+ int poll_count = cur_poll_count - last_reset_poll_count_;
if (reset) {
std::vector<Histogram> to_merge(threads_.size());
std::vector<StatusHistogram> to_merge_status(threads_.size());
@@ -178,7 +179,7 @@
MergeStatusHistogram(to_merge_status[i], &statuses);
}
timer_result = timer->Mark();
- last_reset_poll_count_ = GetPollCount();
+ last_reset_poll_count_ = cur_poll_count;
} else {
// merge snapshots of each thread histogram
for (size_t i = 0; i < threads_.size(); i++) {
@@ -198,10 +199,7 @@
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);
-
- stats.set_cq_poll_count(GetPollCount() - last_reset_poll_count_to_use);
+ stats.set_cq_poll_count(poll_count);
return stats;
}
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 49f9b5c..05756f0 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -211,11 +211,8 @@
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;
+ count += (int)grpc_get_cq_poll_num((*cq)->cq());
}
return count;
}
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index e995156..d75f379 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -63,12 +63,13 @@
ServerStats Mark(bool reset) {
UsageTimer::Result timer_result;
- int last_reset_poll_count_to_use = last_reset_poll_count_;
+ int cur_poll_count = GetPollCount();
+ int poll_count = cur_poll_count - last_reset_poll_count_;
if (reset) {
std::unique_ptr<UsageTimer> timer(new UsageTimer);
timer.swap(timer_);
timer_result = timer->Mark();
- last_reset_poll_count_ = GetPollCount();
+ last_reset_poll_count_ = cur_poll_count;
} else {
timer_result = timer_->Mark();
}
@@ -79,7 +80,7 @@
stats.set_time_user(timer_result.user);
stats.set_total_cpu_time(timer_result.total_cpu_time);
stats.set_idle_cpu_time(timer_result.idle_cpu_time);
- stats.set_cq_poll_count(GetPollCount() - last_reset_poll_count_to_use);
+ stats.set_cq_poll_count(poll_count);
return stats;
}
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 4bd7af3..7d00cb3 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -160,11 +160,8 @@
int GetPollCount() {
int count = 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);
- count += k;
+ count += (int)grpc_get_cq_poll_num((*cq)->cq());
}
return count;
}