Function prepare

Synopsis

#include <include/internal/benchmark/catch_benchmark.hpp>

template <typename Clock>
ExecutionPlan< FloatDuration< Clock > > prepare(const IConfig &cfg, Environment< FloatDuration< Clock >> env) const

Description

No description yet.

Source

Lines 44-51 in include/internal/benchmark/catch_benchmark.hpp.

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)>(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>>(cfg.benchmarkWarmupTime()), Detail::warmup_iterations };
}





Add Discussion as Guest

Log in