From 2e4d666eec1a372d4b64c527d6c4945ad98d2b58 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Sep 2022 21:19:57 -0400 Subject: Update clang-format configuration --- benchmark/bench_utils.hpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'benchmark/bench_utils.hpp') diff --git a/benchmark/bench_utils.hpp b/benchmark/bench_utils.hpp index a3f7f81..620cb27 100644 --- a/benchmark/bench_utils.hpp +++ b/benchmark/bench_utils.hpp @@ -28,37 +28,37 @@ using Duration = std::chrono::duration; /// Write a TSV row to `os` with `n` as the first column followed by `results` -template +template void write_row(std::ostream& os, const size_t n, const std::array& results) { - os << n; - for (const auto t : results) { - if (t == Duration::zero()) { - os << "\tNaN"; - } else { - os << '\t' << t.count(); - } - } - os << std::endl; + os << n; + for (const auto t : results) { + if (t == Duration::zero()) { + os << "\tNaN"; + } else { + os << '\t' << t.count(); + } + } + os << std::endl; } /// Repeatedly run an operation and return the average time -template +template Duration run_bench(const Operation& op) { - static constexpr auto bench_duration = std::chrono::milliseconds{10}; + static constexpr auto bench_duration = std::chrono::milliseconds{10}; - const auto t_start = std::chrono::steady_clock{}.now(); - auto t_now = t_start; - size_t count = 0; - for (; t_now < t_start + bench_duration; ++count) { - op(count); - t_now = std::chrono::steady_clock{}.now(); - } + const auto t_start = std::chrono::steady_clock{}.now(); + auto t_now = t_start; + size_t count = 0; + for (; t_now < t_start + bench_duration; ++count) { + op(count); + t_now = std::chrono::steady_clock{}.now(); + } - return (t_now - t_start) / count; + return (t_now - t_start) / count; } #endif -- cgit v1.2.1