aboutsummaryrefslogtreecommitdiff
path: root/src/console_reporter.cc
diff options
context:
space:
mode:
authorJoao Paulo Magalhaes <dev@jpmag.me>2017-05-02 18:54:37 +0100
committerJoao Paulo Magalhaes <dev@jpmag.me>2017-05-02 18:54:37 +0100
commit615151723e43b4e925732e33ab428b6d9b3f8b43 (patch)
treee6349e30eb1c865bb09c986b340ccb04c554df95 /src/console_reporter.cc
parent707dd893448cc0bcacde78a45cf4d9d7454eb2fd (diff)
parentda8cd74d85fa44c8feb08e886847517caa35a0d1 (diff)
downloadgoogle-benchmark-615151723e43b4e925732e33ab428b6d9b3f8b43.tar.gz
Merge remote-tracking branch 'upstream/master' into compact
Diffstat (limited to 'src/console_reporter.cc')
-rw-r--r--src/console_reporter.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/console_reporter.cc b/src/console_reporter.cc
index efa584c..fe0dda9 100644
--- a/src/console_reporter.cc
+++ b/src/console_reporter.cc
@@ -53,11 +53,17 @@ bool ConsoleReporter::ReportContext(const Context& context) {
}
void ConsoleReporter::PrintHeader(const Run& run) {
- std::string str =
- FormatString("%-*s %13s %13s %10s\n", static_cast<int>(name_field_width_),
- "Benchmark", "Time", "CPU", "Iterations");
+ std::string str = FormatString("%-*s %13s %13s %10s\n", static_cast<int>(name_field_width_),
+ "Benchmark", "Time", "CPU", "Iterations");
if(!run.counters.empty()) {
- str += " UserCounters...";
+ if(output_options_ & OO_Tabular) {
+ for(auto const& c : run.counters) {
+ str += FormatString(" %10s", c.first);
+ }
+ }
+ else {
+ str += " UserCounters...";
+ }
}
std::string line = std::string(str.length(), '-');
GetOutputStream() << line << "\n" << str << line << "\n";
@@ -143,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);
}
}