diff options
| author | khyperia | 2020-01-27 15:43:27 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-02-16 15:44:23 +0100 |
| commit | 3c7e737a7bcf2d2059b1db2a5a221f76806ae8b0 (patch) | |
| tree | bcbf40fe8e4914c8ecc3a585066933bf871652c7 /src/catch2/benchmark | |
| parent | e880da93bd335e59a0d4b00bfcb9f06ab4b7c847 (diff) | |
| download | catch3-3c7e737a7bcf2d2059b1db2a5a221f76806ae8b0.tar.gz | |
Allow configuring of benchmark warmup time
Diffstat (limited to 'src/catch2/benchmark')
| -rw-r--r-- | src/catch2/benchmark/catch_benchmark.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/catch2/benchmark/catch_benchmark.hpp b/src/catch2/benchmark/catch_benchmark.hpp index a6ffcf7c..154105c5 100644 --- a/src/catch2/benchmark/catch_benchmark.hpp +++ b/src/catch2/benchmark/catch_benchmark.hpp @@ -44,10 +44,10 @@ namespace Catch { template <typename Clock> ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { auto min_time = env.clock_resolution.mean * Detail::minimum_ticks; - auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(Detail::warmup_time)); + auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(cfg.benchmarkWarmupTime())); auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(run_time), 1, fun); int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed)); - return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(Detail::warmup_time), Detail::warmup_iterations }; + return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(cfg.benchmarkWarmupTime()), Detail::warmup_iterations }; } template <typename Clock = default_clock> |