mirror of
https://github.com/google/benchmark.git
synced 2025-03-29 05:20:21 +08:00
Improve examples on ComputeStatistics
(#1881)
This commit is contained in:
parent
62a321d6dc
commit
d26047a0ac
@ -1106,6 +1106,7 @@ void BM_spin_empty(benchmark::State& state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK(BM_spin_empty)
|
BENCHMARK(BM_spin_empty)
|
||||||
|
->Repetitions(3) // or add option --benchmark_repetitions=3
|
||||||
->ComputeStatistics("max", [](const std::vector<double>& v) -> double {
|
->ComputeStatistics("max", [](const std::vector<double>& v) -> double {
|
||||||
return *(std::max_element(std::begin(v), std::end(v)));
|
return *(std::max_element(std::begin(v), std::end(v)));
|
||||||
})
|
})
|
||||||
@ -1125,8 +1126,9 @@ void BM_spin_empty(benchmark::State& state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK(BM_spin_empty)
|
BENCHMARK(BM_spin_empty)
|
||||||
|
->Repetitions(3) // or add option --benchmark_repetitions=3
|
||||||
->ComputeStatistics("ratio", [](const std::vector<double>& v) -> double {
|
->ComputeStatistics("ratio", [](const std::vector<double>& v) -> double {
|
||||||
return std::begin(v) / std::end(v);
|
return v.front() / v.back();
|
||||||
}, benchmark::StatisticUnit::kPercentage)
|
}, benchmark::StatisticUnit::kPercentage)
|
||||||
->Arg(512);
|
->Arg(512);
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user