From 931bcb8bb1296396481cb0b41fb54baf2ece1d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Plewa?= Date: Mon, 14 Apr 2025 17:07:02 +0200 Subject: [PATCH] disable fragmentation output for peak benchmark --- benchmark/benchmark.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/benchmark/benchmark.hpp b/benchmark/benchmark.hpp index 8be2673d97..1d08f5d720 100644 --- a/benchmark/benchmark.hpp +++ b/benchmark/benchmark.hpp @@ -303,6 +303,9 @@ class multiple_malloc_free_benchmark : public benchmark_interface { typename std::vector::const_iterator; std::vector> next_iter; int64_t iterations; + bool log_fragmentation; + multiple_malloc_free_benchmark(bool log_fragmentation = true) + : log_fragmentation(log_fragmentation) {} public: void SetUp(::benchmark::State &state) override { @@ -350,7 +353,7 @@ class multiple_malloc_free_benchmark : public benchmark_interface { void TearDown(::benchmark::State &state) override { base::allocator.postBench(state); auto tid = state.thread_index(); - if (tid == 0) { + if (tid == 0 && log_fragmentation) { size_t current_memory_allocated = 0; for (const auto &allocationsPerThread : allocations) { for (const auto &allocation : allocationsPerThread) { @@ -517,7 +520,12 @@ template < std::enable_if_t::value>> class peak_alloc_benchmark : public multiple_malloc_free_benchmark { + using base = multiple_malloc_free_benchmark; + + public: + peak_alloc_benchmark() : base(false) {} + virtual void prepareWorkload(benchmark::State &state) override { // Retrieve the thread index and corresponding operation buffer. auto tid = state.thread_index();