Commit ef6b4fb8 by Joao Paulo Magalhaes

Simplify printing of counters in console reporter.

parent 8f69e4f6
...@@ -132,14 +132,10 @@ void ConsoleReporter::PrintRunData(const Run& result) { ...@@ -132,14 +132,10 @@ void ConsoleReporter::PrintRunData(const Run& result) {
} }
for (auto& c : result.counters) { for (auto& c : result.counters) {
auto const& s = HumanReadableNumber(c.second.value); std::string s = HumanReadableNumber(c.second.value);
if (c.second.flags & Counter::Flags::kIsRate) { const char* unit = ((c.second.flags & Counter::Flags::kIsRate) ?
std::string counter_rate = StrCat(HumanReadableNumber(c.second.value), "/s"); "/s" : "");
printer(Out, COLOR_DEFAULT, " %s=%s", c.first.c_str(), counter_rate.c_str()); printer(Out, COLOR_DEFAULT, " %s=%s%s", c.first.c_str(), s.c_str(), unit);
}
else {
printer(Out, COLOR_DEFAULT, " %s=%s", c.first.c_str(), s.c_str());
}
} }
if (!rate.empty()) { if (!rate.empty()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment