Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into compact
  • Loading branch information
biojppm committed May 2, 2017
commit 615151723e43b4e925732e33ab428b6d9b3f8b43
23 changes: 16 additions & 7 deletions src/console_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ bool ConsoleReporter::ReportContext(const Context& context) {
}

void ConsoleReporter::PrintHeader(const Run& run) {
std::string str =
FormatString("%-*s %13s %13s %10s%s\n", static_cast<int>(name_field_width_),
"Benchmark", "Time", "CPU", "Iterations",
(run.counters.empty() ? "" : " UserCounters...")
);
std::string str = FormatString("%-*s %13s %13s %10s\n", static_cast<int>(name_field_width_),
"Benchmark", "Time", "CPU", "Iterations");
if(!run.counters.empty()) {
if(output_options_ & OO_Tabular) {
for(auto const& c : run.counters) {
str += FormatString(" %10s", c.first);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c.first.c_str() i think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! :-P

}
}
else {
str += " UserCounters...";
}
}
std::string line = std::string(str.length(), '-');
GetOutputStream() << line << "\n" << str << line << "\n";
}
Expand Down Expand Up @@ -142,10 +149,12 @@ void ConsoleReporter::PrintRunData(const Run& result) {

for (auto& c : result.counters) {
auto const& s = HumanReadableNumber(c.second.value);
const char* unit = (c.second.flags & Counter::kIsRate) ? "/s" : "";
if(output_options_ & OO_Tabular) {
printer(Out, COLOR_DEFAULT, " %10s", s.c_str());
printer(Out, COLOR_DEFAULT, " %10s%s", s.c_str(), unit);
} else {
printer(Out, COLOR_DEFAULT, " %s=%s", c.first.c_str(), s.c_str());
printer(Out, COLOR_DEFAULT, " %s=%s%s", c.first.c_str(), s.c_str(),
unit);
}
}

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.