Skip to content

Commit 9bab7b4

Browse files
committed
#2275: Don't print memory usage in perf tests when not needed
1 parent ae7478d commit 9bab7b4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/perf/common/test_harness.cc

+12-3
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ std::string PerfTestHarness::OutputMemoryUse() const {
235235
auto const node = per_node_mem.first;
236236
auto const& memory_use = per_node_mem.second;
237237

238+
if(memory_use.empty()){
239+
continue;
240+
}
241+
238242
std::size_t cur_min = std::numeric_limits<std::size_t>::max();
239243
std::size_t cur_max = 0;
240244

@@ -317,12 +321,16 @@ void PerfTestHarness::DumpResults() {
317321
);
318322

319323
auto const time_file_data = OutputTimeResults();
320-
auto const memory_file = OutputMemoryUse();
321-
322324
if (gen_file_) {
323-
OutputToFile(fmt::format("{}_mem", name_), memory_file);
324325
OutputToFile(fmt::format("{}_time", name_), time_file_data);
325326
}
327+
328+
if(print_memory_use_) {
329+
auto const memory_file = OutputMemoryUse();
330+
if (gen_file_) {
331+
OutputToFile(fmt::format("{}_mem", name_), memory_file);
332+
}
333+
}
326334
}
327335
}
328336

@@ -443,6 +451,7 @@ void PerfTestHarness::SpinScheduler() {
443451
void PerfTestHarness::GetMemoryUsage() {
444452
// Memory footprint from PerfTestHarness' internal data structs are included
445453
memory_use_[current_run_].push_back(mem_tracker_.getUsage());
454+
print_memory_use_ = true;
446455
}
447456

448457
}}}} // namespace vt::tests::perf::common

tests/perf/common/test_harness.h

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ struct PerfTestHarness : TestHarnessBase {
174174
protected:
175175
bool gen_file_ = false;
176176
bool verbose_ = false;
177+
bool print_memory_use_ = false;
177178
uint32_t num_runs_ = 20;
178179
uint32_t current_run_ = 0;
179180
std::vector<char*> custom_args_ = {};

0 commit comments

Comments
 (0)