From d147797aaccb71f44d7ee3df94dcf14f8d713247 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 27 Jun 2016 13:24:13 -0500 Subject: [PATCH] Add state.SetComplexityN to docs. (#245) Add `state.SetComplexityN(state.range_x());` to documentation so that complexity is calculated correctly. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 498ed613..e1ac17a0 100644 --- a/README.md +++ b/README.md @@ -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);