ReactorBenchmarks: Sweep coroutine perf. Time the Fibonacci function in iterations of 8^N, where N=[0..8] Bug: b/148660286 Change-Id: Ief391a7f6181c5907de128f5c983ac32aeadfae0 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40949 Tested-by: Ben Clayton <bclayton@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/ReactorBenchmarks.cpp b/src/Reactor/ReactorBenchmarks.cpp index 613ffde..30c239f 100644 --- a/src/Reactor/ReactorBenchmarks.cpp +++ b/src/Reactor/ReactorBenchmarks.cpp
@@ -27,7 +27,7 @@ void TearDown(const ::benchmark::State &state) {} }; -BENCHMARK_F(Coroutines, Fibonacci) +BENCHMARK_DEFINE_F(Coroutines, Fibonacci) (benchmark::State &state) { using namespace rr; @@ -55,9 +55,16 @@ auto coroutine = function(); + const auto iterations = state.range(0); + int out = 0; for(auto _ : state) { - coroutine->await(out); + for(int64_t i = 0; i < iterations; i++) + { + coroutine->await(out); + } } } + +BENCHMARK_REGISTER_F(Coroutines, Fibonacci)->RangeMultiplier(8)->Range(1, 0x1000000)->ArgName("iterations");