diff options
author | Dominic Hamon <dma+github@stripysock.com> | 2015-03-11 09:47:15 -0700 |
---|---|---|
committer | Dominic Hamon <dma+github@stripysock.com> | 2015-03-11 09:47:15 -0700 |
commit | d68127d8adc1111c49b372ba12f7c3e4f053a2f0 (patch) | |
tree | 9bbfcf9fe6d186017513fc0b295f98582a1f3e28 /test/benchmark_test.cc | |
parent | e975efdb7ab062aa821cc46780a5447538d77565 (diff) | |
download | google-benchmark-d68127d8adc1111c49b372ba12f7c3e4f053a2f0.tar.gz |
Enable UseRealTime and fix documentation for SetLabel.
Fixes #89
UseRealTime was defined in the internal namespace by mistake.
Similarly, documentation suggested that benchmark::SetLabel should be
used to set a label, and a function was declared but not defined, while
actually the call should be 'state.SetLabel'.
Diffstat (limited to 'test/benchmark_test.cc')
-rw-r--r-- | test/benchmark_test.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/benchmark_test.cc b/test/benchmark_test.cc index ec49fcd..2ce1001 100644 --- a/test/benchmark_test.cc +++ b/test/benchmark_test.cc @@ -57,6 +57,17 @@ static void BM_Factorial(benchmark::State& state) { } BENCHMARK(BM_Factorial); +static void BM_FactorialRealTime(benchmark::State& state) { + benchmark::UseRealTime(); + + int fac_42 = 0; + while (state.KeepRunning()) + fac_42 = Factorial(8); + // Prevent compiler optimizations + std::cout << fac_42; +} +BENCHMARK(BM_FactorialRealTime); + static void BM_CalculatePiRange(benchmark::State& state) { double pi = 0.0; while (state.KeepRunning()) |