Commit 36a251ab by Eric Fiselier

Fix #300. Emit RMS as a float not a percentage in JSON

parent 2555035f
...@@ -47,6 +47,10 @@ std::string FormatKV(std::string const& key, int64_t value) { ...@@ -47,6 +47,10 @@ std::string FormatKV(std::string const& key, int64_t value) {
return ss.str(); 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); } int64_t RoundDouble(double v) { return static_cast<int64_t>(v + 0.5); }
} // end namespace } // end namespace
...@@ -138,7 +142,7 @@ void JSONReporter::PrintRunData(Run const& run) { ...@@ -138,7 +142,7 @@ void JSONReporter::PrintRunData(Run const& run) {
out << indent << FormatKV("time_unit", GetTimeUnitString(run.time_unit)); out << indent << FormatKV("time_unit", GetTimeUnitString(run.time_unit));
} else if (run.report_rms) { } else if (run.report_rms) {
out << indent out << indent
<< FormatKV("rms", RoundDouble(run.GetAdjustedCPUTime() * 100)) << '%'; << FormatKV("rms", run.GetAdjustedCPUTime());
} }
if (run.bytes_per_second > 0.0) { if (run.bytes_per_second > 0.0) {
out << ",\n" out << ",\n"
......
...@@ -31,7 +31,7 @@ int AddComplexityTest(std::string big_o_test_name, std::string rms_test_name, ...@@ -31,7 +31,7 @@ int AddComplexityTest(std::string big_o_test_name, std::string rms_test_name,
{"\"time_unit\": \"ns\"$", MR_Next}, {"\"time_unit\": \"ns\"$", MR_Next},
{"}", MR_Next}, {"}", MR_Next},
{"\"name\": \"%rms_name\",$"}, {"\"name\": \"%rms_name\",$"},
{"\"rms\": [0-9]+%$", MR_Next}, {"\"rms\": %float$", MR_Next},
{"}", MR_Next}}); {"}", MR_Next}});
AddCases(TC_CSVOut, {{"^\"%bigo_name\",,%float,%float,%bigo,,,,,$"}, AddCases(TC_CSVOut, {{"^\"%bigo_name\",,%float,%float,%bigo,,,,,$"},
{"^\"%bigo_name\"", MR_Not}, {"^\"%bigo_name\"", MR_Not},
......
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