mirror of
https://github.com/google/benchmark.git
synced 2024-11-28 15:34:33 +00:00
3d85343d65
* Rewrite complexity_test to use (hardcoded) manual time This test is fundamentally flaky, because it tried to read tea leafs, and is inherently misbehaving in CI environments, since there are unmitigated sources of noise. That being said, the computed Big-O also depends on the `--benchmark_min_time=` Fixes https://github.com/google/benchmark/issues/272 * Correctly compute Big-O for manual timings. Fixes #1758. * complexity_test: do more stuff in empty loop * Make all empty loops be a bit longer empty Looks like on windows, some of these tests still fail, i guess clock precision is too small.
10 lines
248 B
C++
10 lines
248 B
C++
#include "benchmark/benchmark.h"
|
|
|
|
void BM_empty(benchmark::State& state) {
|
|
for (auto _ : state) {
|
|
auto iterations = double(state.iterations()) * double(state.iterations());
|
|
benchmark::DoNotOptimize(iterations);
|
|
}
|
|
}
|
|
BENCHMARK(BM_empty);
|