Skip to content

Commit

Permalink
perf_tests: Inline print_text_header() into stdout_printer
Browse files Browse the repository at this point in the history
Move print_text_header() into stdout_printer::print_configuration() since
it's the only remaining caller. This simplifies the code by reducing
function indirection and keeping related functionality together.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Jan 16, 2025
1 parent f2df55b commit f6b0d5a
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions tests/perf/perf_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,6 @@ struct column {

using columns = std::vector<column>;

static void print_text_header(std::FILE* out,
const columns& cols,
int name_length,
const char* start_delim = "", // before the line
const char* middle_delim = " ", // between each column
const char* end_delim = "", // end of line
const char* test_name_header = "test",
const char* header_override = nullptr) {

fmt::print(out, "{}{:<{}}", start_delim, header_override ? header_override : test_name_header, name_length);
for (auto& c : cols) {
fmt::print(out, "{}", middle_delim);
c.print_header(out, header_override);
}
fmt::print(out, "{}\n", end_delim);
}

static void print_result_columns(std::FILE* out,
const columns& cols,
int name_length,
Expand Down Expand Up @@ -321,7 +304,15 @@ struct stdout_printer final : result_printer {
"number of runs:", c.number_of_runs,
"number of cores:", smp::count,
"random seed:", c.random_seed);
print_text_header(stdout, text_columns, name_column_length());

fmt::print("{:<{}}", "test", name_column_length());
for (auto& c : text_columns) {
// a middle delimiter between each column
fmt::print(" ");
c.print_header(stdout);
}
// end of line
fmt::print("\n");
}

virtual void print_result(const result& r) override {
Expand Down

0 comments on commit f6b0d5a

Please sign in to comment.