@@ -303,6 +303,9 @@ class multiple_malloc_free_benchmark : public benchmark_interface<Size, Alloc> {
303303 typename std::vector<next_alloc_data>::const_iterator;
304304 std::vector<std::unique_ptr<next_alloc_data_iterator>> next_iter;
305305 int64_t iterations;
306+ bool log_fragmentation;
307+ multiple_malloc_free_benchmark (bool log_fragmentation = true )
308+ : log_fragmentation(log_fragmentation) {}
306309
307310 public:
308311 void SetUp (::benchmark::State &state) override {
@@ -350,7 +353,7 @@ class multiple_malloc_free_benchmark : public benchmark_interface<Size, Alloc> {
350353 void TearDown (::benchmark::State &state) override {
351354 base::allocator.postBench (state);
352355 auto tid = state.thread_index ();
353- if (tid == 0 ) {
356+ if (tid == 0 && log_fragmentation ) {
354357 size_t current_memory_allocated = 0 ;
355358 for (const auto &allocationsPerThread : allocations) {
356359 for (const auto &allocation : allocationsPerThread) {
@@ -517,7 +520,12 @@ template <
517520 std::enable_if_t <std::is_base_of<allocator_interface, Alloc>::value>>
518521class peak_alloc_benchmark
519522 : public multiple_malloc_free_benchmark<Size, Alloc> {
523+
520524 using base = multiple_malloc_free_benchmark<Size, Alloc>;
525+
526+ public:
527+ peak_alloc_benchmark () : base(false ) {}
528+
521529 virtual void prepareWorkload (benchmark::State &state) override {
522530 // Retrieve the thread index and corresponding operation buffer.
523531 auto tid = state.thread_index ();
0 commit comments