diff options
author | ncteisen <ncteisen@gmail.com> | 2017-03-13 21:18:58 -0700 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2017-03-13 21:18:58 -0700 |
commit | 91220dc7932ab4e7f3e924e736b61911d3c420e3 (patch) | |
tree | 855f6a305969bc9289e8eb1fd55eb59923ef5071 | |
parent | 4b36a3d9eaaab2f39dcebfcd47f48185be158b49 (diff) |
Added benchmark to show static vs copied
-rw-r--r-- | test/cpp/microbenchmarks/bm_error.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index cd7644c75d..00e1a08cab 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -51,14 +51,23 @@ class ErrorDeleter { }; typedef std::unique_ptr<grpc_error, ErrorDeleter> ErrorPtr; -static void BM_ErrorCreate(benchmark::State& state) { +static void BM_ErrorCreateFromStatic(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { GRPC_ERROR_UNREF(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error")); } track_counters.Finish(state); } -BENCHMARK(BM_ErrorCreate); +BENCHMARK(BM_ErrorCreateFromStatic); + +static void BM_ErrorCreateFromCopied(benchmark::State& state) { + TrackCounters track_counters; + while (state.KeepRunning()) { + GRPC_ERROR_UNREF(GRPC_ERROR_CREATE_FROM_COPIED_STRING("Error not inline")); + } + track_counters.Finish(state); +} +BENCHMARK(BM_ErrorCreateFromCopied); static void BM_ErrorCreateAndSetStatus(benchmark::State& state) { TrackCounters track_counters; |