aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-07-19 16:24:19 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-07-19 16:24:19 -0700
commitb89304652b162453df2ad21ab45123735a106392 (patch)
tree6560a0b705e1104747ac95f76e315d35e4b44d0c /test/cpp/microbenchmarks
parent7466151ee91abf5168bf6375756382a97bd3aba5 (diff)
Build simplification
Diffstat (limited to 'test/cpp/microbenchmarks')
-rw-r--r--test/cpp/microbenchmarks/helpers.cc7
-rw-r--r--test/cpp/microbenchmarks/helpers.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/test/cpp/microbenchmarks/helpers.cc b/test/cpp/microbenchmarks/helpers.cc
index 0c10d6c4ce..415d27445f 100644
--- a/test/cpp/microbenchmarks/helpers.cc
+++ b/test/cpp/microbenchmarks/helpers.cc
@@ -29,6 +29,13 @@ void TrackCounters::Finish(benchmark::State &state) {
}
void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) {
+ grpc_stats_data stats_end;
+ grpc_stats_collect(&stats_end);
+ for (int i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
+ out << " " << grpc_stats_counter_name[i] << "/iter:"
+ << ((double)(stats_end.counters[i] - stats_begin_.counters[i]) /
+ (double)state.iterations());
+ }
#ifdef GPR_LOW_LEVEL_COUNTERS
grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot();
out << " locks/iter:" << ((double)(gpr_atm_no_barrier_load(&gpr_mu_locks) -
diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h
index c81d95a4ea..07dd611709 100644
--- a/test/cpp/microbenchmarks/helpers.h
+++ b/test/cpp/microbenchmarks/helpers.h
@@ -23,6 +23,7 @@
extern "C" {
#include <grpc/support/port_platform.h>
+#include "src/core/lib/debug/stats.h"
#include "test/core/util/memory_counters.h"
}
@@ -62,10 +63,12 @@ extern "C" gpr_atm gpr_now_call_count;
class TrackCounters {
public:
+ TrackCounters() { grpc_stats_collect(&stats_begin_); }
virtual void Finish(benchmark::State& state);
virtual void AddToLabel(std::ostream& out, benchmark::State& state);
private:
+ grpc_stats_data stats_begin_;
#ifdef GPR_LOW_LEVEL_COUNTERS
const size_t mu_locks_at_start_ = gpr_atm_no_barrier_load(&gpr_mu_locks);
const size_t atm_cas_at_start_ =