@@ -303,6 +303,9 @@ class multiple_malloc_free_benchmark : public benchmark_interface<Size, Alloc> {
303
303
typename std::vector<next_alloc_data>::const_iterator;
304
304
std::vector<std::unique_ptr<next_alloc_data_iterator>> next_iter;
305
305
int64_t iterations;
306
+ bool log_fragmentation;
307
+ multiple_malloc_free_benchmark (bool log_fragmentation = true )
308
+ : log_fragmentation(log_fragmentation) {}
306
309
307
310
public:
308
311
void SetUp (::benchmark::State &state) override {
@@ -350,7 +353,7 @@ class multiple_malloc_free_benchmark : public benchmark_interface<Size, Alloc> {
350
353
void TearDown (::benchmark::State &state) override {
351
354
base::allocator.postBench (state);
352
355
auto tid = state.thread_index ();
353
- if (tid == 0 ) {
356
+ if (tid == 0 && log_fragmentation ) {
354
357
size_t current_memory_allocated = 0 ;
355
358
for (const auto &allocationsPerThread : allocations) {
356
359
for (const auto &allocation : allocationsPerThread) {
@@ -517,7 +520,12 @@ template <
517
520
std::enable_if_t <std::is_base_of<allocator_interface, Alloc>::value>>
518
521
class peak_alloc_benchmark
519
522
: public multiple_malloc_free_benchmark<Size , Alloc> {
523
+
520
524
using base = multiple_malloc_free_benchmark<Size , Alloc>;
525
+
526
+ public:
527
+ peak_alloc_benchmark () : base(false ) {}
528
+
521
529
virtual void prepareWorkload (benchmark::State &state) override {
522
530
// Retrieve the thread index and corresponding operation buffer.
523
531
auto tid = state.thread_index ();
0 commit comments