Skip to content

Commit

Permalink
Improve examples on ComputeStatistics
Browse files Browse the repository at this point in the history
  • Loading branch information
guoci authored Nov 26, 2024
1 parent 62a321d commit 7510c5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,7 @@ void BM_spin_empty(benchmark::State& state) {
}
BENCHMARK(BM_spin_empty)
->Repetitions(3) // or add option --benchmark_repetitions=3
->ComputeStatistics("max", [](const std::vector<double>& v) -> double {
return *(std::max_element(std::begin(v), std::end(v)));
})
Expand All @@ -1125,8 +1126,9 @@ void BM_spin_empty(benchmark::State& state) {
}

BENCHMARK(BM_spin_empty)
->Repetitions(3) // or add option --benchmark_repetitions=3
->ComputeStatistics("ratio", [](const std::vector<double>& v) -> double {
return std::begin(v) / std::end(v);
return v.front() / v.back();
}, benchmark::StatisticUnit::kPercentage)
->Arg(512);
```
Expand Down

0 comments on commit 7510c5f

Please sign in to comment.