Skip to content

Commit

Permalink
#2275: Don't print memory usage in perf tests when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Apr 26, 2024
1 parent ae7478d commit 9bab7b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/perf/common/test_harness.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::size_t>::max();
std::size_t cur_max = 0;

Expand Down Expand Up @@ -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);
}
}
}
}

Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions tests/perf/common/test_harness.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<char*> custom_args_ = {};
Expand Down

0 comments on commit 9bab7b4

Please sign in to comment.