diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2018-01-30 19:12:59 +0100 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2018-01-30 19:24:56 +0100 |
commit | 12ba4b1e05ca420008c38234e13c5540b3b704c0 (patch) | |
tree | d26aae57f7b32e92ae15d76a0ab3ebf20c22893e /test/cpp/microbenchmarks/fullstack_fixtures.h | |
parent | e6cf0aeff4979e5ff2501e7fe5e2fdf926350452 (diff) |
make grpc_passthru_endpoint_stats refcounted
Diffstat (limited to 'test/cpp/microbenchmarks/fullstack_fixtures.h')
-rw-r--r-- | test/cpp/microbenchmarks/fullstack_fixtures.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index d1ede755a5..7e93cbd74d 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -252,20 +252,27 @@ class InProcessCHTTP2 : public EndpointPairFixture { FixtureConfiguration()) : EndpointPairFixture(service, MakeEndpoints(), fixture_configuration) {} + virtual ~InProcessCHTTP2() { grpc_passthru_endpoint_stats_destroy(stats_); } + void AddToLabel(std::ostream& out, benchmark::State& state) { EndpointPairFixture::AddToLabel(out, state); out << " writes/iter:" - << static_cast<double>(gpr_atm_no_barrier_load(&stats_.num_writes)) / + << static_cast<double>(gpr_atm_no_barrier_load(&stats_->num_writes)) / static_cast<double>(state.iterations()); } private: - grpc_passthru_endpoint_stats stats_; + grpc_passthru_endpoint_stats* stats_; grpc_endpoint_pair MakeEndpoints() { + stats_ = grpc_passthru_endpoint_stats_create(); // is there a better way to + // initialize stats_ and + // pass MakeEndpoints's + // return value to base + // constructor? grpc_endpoint_pair p; grpc_passthru_endpoint_create(&p.client, &p.server, Library::get().rq(), - &stats_); + stats_); return p; } }; |