Function run

Synopsis

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

template <typename Clock>
std::vector< FloatDuration< Clock > > run(const IConfig &cfg, Environment< FloatDuration< Clock >> env) const

Description

No description yet.

Source

Lines 38-53 in include/internal/benchmark/catch_execution_plan.hpp.

template <typename Clock>
std::vector<FloatDuration<Clock>> run(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const {
    // warmup a bit
    Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_iterations, Detail::repeat(now<Clock>{}));
    std::vector<FloatDuration<Clock>> times;
    times.reserve(cfg.benchmarkSamples());
    std::generate_n(std::back_inserter(times), cfg.benchmarkSamples(), [this, env] {
        Detail::ChronometerModel<Clock> model;
        this->benchmark(Chronometer(model, iterations_per_sample));
        auto sample_time = model.elapsed() - env.clock_cost.mean;
        if (sample_time < FloatDuration<Clock>::zero()) sample_time = FloatDuration<Clock>::zero();
        return sample_time / iterations_per_sample;
    });
    return times;
}





Add Discussion as Guest

Log in