diff options
Diffstat (limited to 'test/cpp/microbenchmarks/bm_error.cc')
-rw-r--r-- | test/cpp/microbenchmarks/bm_error.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index ff1519b1f4..c4f6aa19d5 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -72,32 +72,38 @@ static void BM_ErrorCreateAndSetStatus(benchmark::State& state) { BENCHMARK(BM_ErrorCreateAndSetStatus); static void BM_ErrorCreateAndSetIntAndStr(benchmark::State& state) { + TrackCounters track_counters; while (state.KeepRunning()) { GRPC_ERROR_UNREF(grpc_error_set_str( grpc_error_set_int(GRPC_ERROR_CREATE("GOAWAY received"), GRPC_ERROR_INT_HTTP2_ERROR, (intptr_t)0), GRPC_ERROR_STR_RAW_BYTES, "raw bytes")); } + track_counters.Finish(state); } BENCHMARK(BM_ErrorCreateAndSetIntAndStr); static void BM_ErrorCreateAndSetIntLoop(benchmark::State& state) { + TrackCounters track_counters; grpc_error* error = GRPC_ERROR_CREATE("Error"); int n = 0; while (state.KeepRunning()) { error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS, n++); } GRPC_ERROR_UNREF(error); + track_counters.Finish(state); } BENCHMARK(BM_ErrorCreateAndSetIntLoop); static void BM_ErrorCreateAndSetStrLoop(benchmark::State& state) { + TrackCounters track_counters; grpc_error* error = GRPC_ERROR_CREATE("Error"); const char* str = "hello"; while (state.KeepRunning()) { error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE, str); } GRPC_ERROR_UNREF(error); + track_counters.Finish(state); } BENCHMARK(BM_ErrorCreateAndSetStrLoop); |