aboutsummaryrefslogtreecommitdiff
path: root/src/json_reporter.cc
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-10-07 22:26:01 -0600
committerEric Fiselier <eric@efcs.ca>2016-10-07 22:26:01 -0600
commit36a251ab3ee4e6dc668129e0ef5fa62b1b8d5d49 (patch)
tree52484b8d93c2b34df5e6f094bf2ba09e2c5fa137 /src/json_reporter.cc
parent2555035f44d82160e51261c3add92cc38af352a7 (diff)
downloadgoogle-benchmark-36a251ab3ee4e6dc668129e0ef5fa62b1b8d5d49.tar.gz
Fix #300. Emit RMS as a float not a percentage in JSON
Diffstat (limited to 'src/json_reporter.cc')
-rw-r--r--src/json_reporter.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/json_reporter.cc b/src/json_reporter.cc
index 8eaef07..cea5f9b 100644
--- a/src/json_reporter.cc
+++ b/src/json_reporter.cc
@@ -47,6 +47,10 @@ std::string FormatKV(std::string const& key, int64_t value) {
return ss.str();
}
+std::string FormatKV(std::string const& key, double value) {
+ return StringPrintF("\"%s\": %.2f", key.c_str(), value);
+}
+
int64_t RoundDouble(double v) { return static_cast<int64_t>(v + 0.5); }
} // end namespace
@@ -138,7 +142,7 @@ void JSONReporter::PrintRunData(Run const& run) {
out << indent << FormatKV("time_unit", GetTimeUnitString(run.time_unit));
} else if (run.report_rms) {
out << indent
- << FormatKV("rms", RoundDouble(run.GetAdjustedCPUTime() * 100)) << '%';
+ << FormatKV("rms", run.GetAdjustedCPUTime());
}
if (run.bytes_per_second > 0.0) {
out << ",\n"