Commit d147797a by Nick Committed by Dominic Hamon

Add state.SetComplexityN to docs. (#245)

Add `state.SetComplexityN(state.range_x());` to documentation so that complexity is calculated correctly.
parent 1d53e5e0
......@@ -127,8 +127,10 @@ running time and the normalized root-mean square error of string comparison.
static void BM_StringCompare(benchmark::State& state) {
std::string s1(state.range_x(), '-');
std::string s2(state.range_x(), '-');
while (state.KeepRunning())
while (state.KeepRunning()) {
benchmark::DoNotOptimize(s1.compare(s2));
}
state.SetComplexityN(state.range_x());
}
BENCHMARK(BM_StringCompare)
->RangeMultiplier(2)->Range(1<<10, 1<<18)->Complexity(benchmark::oN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment