google / google/benchmark

Fail when calculating complexity

Open
#410 3 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
C++
Stars
10.4k
Forks
1.8k
Avg merge
2d 4h
Merged PRs (30d)
8

Description

When calculating time complexity and the range includes 0 it fails upon evaluation.
```
void BM_Example(benchmark::State& state)
{
while (state.KeepRunning())
{
int i = state.range(0);
}
state.SetComplexityN(state.range(0));
}

BENCHMARK(BM_JumpTable)->RangeMultiplier(2)->Range(0, 1)->Complexity(benchmark::o1);
```
Result

```F:\cruft\benchmark\src\complexity.cc:270: benchmark::ComputeBigO: Check (run.complexity_n) > (0)' Failed. Did you forget to call SetComplexityN?```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.