diff options
author | Dominic Hamon <dominic@google.com> | 2016-05-02 12:04:16 -0700 |
---|---|---|
committer | Dominic Hamon <dominic@google.com> | 2016-05-02 12:04:16 -0700 |
commit | 02f409a71f5231bf9b8803e771bdfa1056da23cc (patch) | |
tree | e7f0b068712c50e2425e8ec39ebb1a7fffd9e16d /src/console_reporter.cc | |
parent | 9fa66eb1305a4d12db94e4c7162326ae8aca1eac (diff) | |
download | google-benchmark-02f409a71f5231bf9b8803e771bdfa1056da23cc.tar.gz |
Only output optional fields if they're set
Diffstat (limited to 'src/console_reporter.cc')
-rw-r--r-- | src/console_reporter.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/console_reporter.cc b/src/console_reporter.cc index 375e861..56bd3ce 100644 --- a/src/console_reporter.cc +++ b/src/console_reporter.cc @@ -99,6 +99,7 @@ void ConsoleReporter::PrintRunData(const Run& result) { ColorPrintf(COLOR_GREEN, "%-*s ", name_field_width_, result.benchmark_name.c_str()); + if (result.iterations == 0) { ColorPrintf(COLOR_YELLOW, "%10.0f %s %10.0f %s ", result.real_accumulated_time * multiplier, @@ -114,11 +115,22 @@ void ConsoleReporter::PrintRunData(const Run& result) { (static_cast<double>(result.iterations)), timeLabel); } + ColorPrintf(COLOR_CYAN, "%10lld", result.iterations); - ColorPrintf(COLOR_DEFAULT, "%*s %*s %s\n", - 13, rate.c_str(), - 18, items.c_str(), - result.report_label.c_str()); + + if (!rate.empty()) { + ColorPrintf(COLOR_DEFAULT, " %*s", 13, rate.c_str()); + } + + if (!items.empty()) { + ColorPrintf(COLOR_DEFAULT, " %*s", 18, items.c_str()); + } + + if (!result.report_label.empty()) { + ColorPrintf(COLOR_DEFAULT, " %s", result.report_label.c_str()); + } + + ColorPrintf(COLOR_DEFAULT, "\n"); } } // end namespace benchmark |