diff options
author | ncteisen <ncteisen@gmail.com> | 2018-04-25 12:00:28 -0700 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2018-04-25 17:41:23 -0700 |
commit | 40ec89ff67ffb6010e2a23b9c6d31d336b23fe80 (patch) | |
tree | e7aa0377da853c41057e581ec2f38d7d3b802ad4 /test/cpp/microbenchmarks/bm_closure.cc | |
parent | 246071a4e22d3d2ea19dad8714b19ef2dae5464a (diff) |
Support microbenchmarks internally
Diffstat (limited to 'test/cpp/microbenchmarks/bm_closure.cc')
-rw-r--r-- | test/cpp/microbenchmarks/bm_closure.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index 6d88faecc0..8bdc3b9385 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -28,6 +28,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "test/cpp/microbenchmarks/helpers.h" +#include "test/cpp/util/test_config.h" auto& force_library_initialization = Library::get(); @@ -415,4 +416,15 @@ static void BM_ClosureReschedOnCombinerFinally(benchmark::State& state) { } BENCHMARK(BM_ClosureReschedOnCombinerFinally); -BENCHMARK_MAIN(); +// Some distros have RunSpecifiedBenchmarks under the benchmark namespace, +// and others do not. This allows us to support both modes. +namespace benchmark { +void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); } +} // namespace benchmark + +int main(int argc, char** argv) { + ::benchmark::Initialize(&argc, argv); + ::grpc::testing::InitTest(&argc, &argv, false); + benchmark::RunTheBenchmarksNamespaced(); + return 0; +} |