diff options
author | 2018-01-30 19:12:59 +0100 | |
---|---|---|
committer | 2018-01-30 19:24:56 +0100 | |
commit | 12ba4b1e05ca420008c38234e13c5540b3b704c0 (patch) | |
tree | d26aae57f7b32e92ae15d76a0ab3ebf20c22893e /test/cpp/microbenchmarks/bm_fullstack_trickle.cc | |
parent | e6cf0aeff4979e5ff2501e7fe5e2fdf926350452 (diff) |
make grpc_passthru_endpoint_stats refcounted
Diffstat (limited to 'test/cpp/microbenchmarks/bm_fullstack_trickle.cc')
-rw-r--r-- | test/cpp/microbenchmarks/bm_fullstack_trickle.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc index d6d7d41e5e..07a8102915 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc @@ -101,9 +101,11 @@ class TrickledCHTTP2 : public EndpointPairFixture { } } + virtual ~TrickledCHTTP2() { grpc_passthru_endpoint_stats_destroy(stats_); } + void AddToLabel(std::ostream& out, benchmark::State& state) { out << " writes/iter:" - << ((double)stats_.num_writes / (double)state.iterations()) + << ((double)stats_->num_writes / (double)state.iterations()) << " cli_transport_stalls/iter:" << ((double) client_stats_.streams_stalled_due_to_transport_flow_control / @@ -193,7 +195,7 @@ class TrickledCHTTP2 : public EndpointPairFixture { } private: - grpc_passthru_endpoint_stats stats_; + grpc_passthru_endpoint_stats* stats_; struct Stats { int streams_stalled_due_to_stream_flow_control = 0; int streams_stalled_due_to_transport_flow_control = 0; @@ -204,9 +206,14 @@ class TrickledCHTTP2 : public EndpointPairFixture { gpr_timespec start_ = gpr_now(GPR_CLOCK_MONOTONIC); grpc_endpoint_pair MakeEndpoints(size_t kilobits) { + 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_); double bytes_per_second = 125.0 * kilobits; p.client = grpc_trickle_endpoint_create(p.client, bytes_per_second); p.server = grpc_trickle_endpoint_create(p.server, bytes_per_second); |