From 8b9d93259ffc8b757d0ca8c657e8716c888babf8 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 10 Aug 2022 16:28:27 +0200 Subject: [PATCH] blinktree: Made perf functions configurable, so that Chronometer can be used without them. --- .../src/app/blinktree/benchmark/chronometer.h | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/repos/mml/src/app/blinktree/benchmark/chronometer.h b/repos/mml/src/app/blinktree/benchmark/chronometer.h index a9c9210fbd..7014b1aba4 100644 --- a/repos/mml/src/app/blinktree/benchmark/chronometer.h +++ b/repos/mml/src/app/blinktree/benchmark/chronometer.h @@ -1,6 +1,8 @@ #pragma once +#ifdef PERF_SUPPORT #include "perf.h" +#endif #include "phase.h" #include #include @@ -48,7 +50,8 @@ template class InterimResult public: InterimResult(const std::uint64_t operation_count, const P &phase, const std::uint16_t iteration, const std::uint16_t core_count, const std::chrono::milliseconds time, - std::vector &counter, std::unordered_map executed_tasks, + /*std::vector &counter,*/ + std::unordered_map executed_tasks, std::unordered_map executed_reader_tasks, std::unordered_map executed_writer_tasks, std::unordered_map scheduled_tasks, @@ -61,10 +64,12 @@ public: _scheduled_tasks_on_core(std::move(scheduled_tasks_on_core)), _scheduled_tasks_off_core(std::move(scheduled_tasks_off_core)), _worker_fills(std::move(worker_fills)) { - /*for (auto &c : counter) +#ifdef PERF_SUPPORT + for (auto &c : counter) { _performance_counter.emplace_back(std::make_pair(c.name(), c.read())); - }*/ + } +#endif } ~InterimResult() = default; @@ -175,15 +180,18 @@ public: _current_phase = phase; _current_iteration = iteration; _core_set = core_set; - +#ifdef PERF_SUPPORT _perf.start(); +#endif _start = std::chrono::steady_clock::now(); } InterimResult

stop(const std::uint64_t count_operations) { const auto end = std::chrono::steady_clock::now(); +#ifdef PERF_SUPPORT _perf.stop(); +#endif const auto milliseconds = std::chrono::duration_cast(end - _start); @@ -201,14 +209,16 @@ public: statistic_map(mx::tasking::profiling::Statistic::ScheduledOffChannel), statistic_map(mx::tasking::profiling::Statistic::Fill)}; } - +#ifdef PERF_SUPPORT void add(PerfCounter &performance_counter) { _perf.add(performance_counter); } - +#endif private: std::uint16_t _current_iteration{0U}; P _current_phase; mx::util::core_set _core_set; +#ifdef PERF_SUPPORT alignas(64) Perf _perf; +#endif alignas(64) std::chrono::steady_clock::time_point _start; std::unordered_map statistic_map(