diff --git a/tests/perf/common/test_harness.cc b/tests/perf/common/test_harness.cc index c7313fdced..669ff9d028 100644 --- a/tests/perf/common/test_harness.cc +++ b/tests/perf/common/test_harness.cc @@ -235,6 +235,10 @@ std::string PerfTestHarness::OutputMemoryUse() const { auto const node = per_node_mem.first; auto const& memory_use = per_node_mem.second; + if(memory_use.empty()){ + continue; + } + std::size_t cur_min = std::numeric_limits::max(); std::size_t cur_max = 0; @@ -317,12 +321,16 @@ void PerfTestHarness::DumpResults() { ); auto const time_file_data = OutputTimeResults(); - auto const memory_file = OutputMemoryUse(); - if (gen_file_) { - OutputToFile(fmt::format("{}_mem", name_), memory_file); OutputToFile(fmt::format("{}_time", name_), time_file_data); } + + if(print_memory_use_) { + auto const memory_file = OutputMemoryUse(); + if (gen_file_) { + OutputToFile(fmt::format("{}_mem", name_), memory_file); + } + } } } @@ -443,6 +451,7 @@ void PerfTestHarness::SpinScheduler() { void PerfTestHarness::GetMemoryUsage() { // Memory footprint from PerfTestHarness' internal data structs are included memory_use_[current_run_].push_back(mem_tracker_.getUsage()); + print_memory_use_ = true; } }}}} // namespace vt::tests::perf::common diff --git a/tests/perf/common/test_harness.h b/tests/perf/common/test_harness.h index 1b51501937..113ac3175b 100644 --- a/tests/perf/common/test_harness.h +++ b/tests/perf/common/test_harness.h @@ -174,6 +174,7 @@ struct PerfTestHarness : TestHarnessBase { protected: bool gen_file_ = false; bool verbose_ = false; + bool print_memory_use_ = false; uint32_t num_runs_ = 20; uint32_t current_run_ = 0; std::vector custom_args_ = {};