| 7246 | |
| 7247 | template <typename Clock = default_clock> |
| 7248 | void run() { |
| 7249 | IConfigPtr cfg = getCurrentContext().getConfig(); |
| 7250 | |
| 7251 | auto env = Detail::measure_environment<Clock>(); |
| 7252 | |
| 7253 | getResultCapture().benchmarkPreparing(name); |
| 7254 | CATCH_TRY{ |
| 7255 | auto plan = user_code([&] { |
| 7256 | return prepare<Clock>(*cfg, env); |
| 7257 | }); |
| 7258 | |
| 7259 | BenchmarkInfo info { |
| 7260 | name, |
| 7261 | plan.estimated_duration.count(), |
| 7262 | plan.iterations_per_sample, |
| 7263 | cfg->benchmarkSamples(), |
| 7264 | cfg->benchmarkResamples(), |
| 7265 | env.clock_resolution.mean.count(), |
| 7266 | env.clock_cost.mean.count() |
| 7267 | }; |
| 7268 | |
| 7269 | getResultCapture().benchmarkStarting(info); |
| 7270 | |
| 7271 | auto samples = user_code([&] { |
| 7272 | return plan.template run<Clock>(*cfg, env); |
| 7273 | }); |
| 7274 | |
| 7275 | auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end()); |
| 7276 | BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; |
| 7277 | getResultCapture().benchmarkEnded(stats); |
| 7278 | |
| 7279 | } CATCH_CATCH_ALL{ |
| 7280 | if (translateActiveException() != Detail::benchmarkErrorMsg) // benchmark errors have been reported, otherwise rethrow. |
| 7281 | std::rethrow_exception(std::current_exception()); |
| 7282 | } |
nothing calls this directly
no test coverage detected