Increase precision when printing perf_results
The script that processes the RESULT lines doesn't support scientific notation [1],
so "1.234567e+06 units" is interpreted as "1.234567", "e+06 units".
Increase precision so that this is printed as 1234567 instead. I'll also submit a
CL so that the RESULT lines processor supports scientific notation.
[1] https://cs.chromium.org/chromium/build/scripts/slave/performance_log_processor.py?l=410
Bug: chromium:791501
Change-Id: If768d86b7ed07d92541ece6298eac8fe95880e35
Reviewed-on: https://webrtc-review.googlesource.com/29001
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21034}diff --git a/test/testsupport/perf_test.cc b/test/testsupport/perf_test.cc
index affd458..c2a2a50 100644
--- a/test/testsupport/perf_test.cc
+++ b/test/testsupport/perf_test.cc
@@ -55,6 +55,7 @@
const std::string& units,
const bool important) {
std::ostringstream value_stream;
+ value_stream.precision(8);
value_stream << value;
PrintResultsImpl(graph_name, trace_name, value_stream.str(), units,
important);
@@ -74,6 +75,7 @@
const std::string& units,
const bool important) {
std::ostringstream value_stream;
+ value_stream.precision(8);
value_stream << '{' << mean << ',' << error << '}';
PrintResultsImpl(graph_name, trace_name, value_stream.str(), units,
important);
@@ -93,6 +95,7 @@
const std::string& units,
const bool important) {
std::ostringstream value_stream;
+ value_stream.precision(8);
value_stream << '[';
OutputListToStream(&value_stream, values);
value_stream << ']';
diff --git a/test/testsupport/perf_test_unittest.cc b/test/testsupport/perf_test_unittest.cc
index f80bcf8..514196b 100644
--- a/test/testsupport/perf_test_unittest.cc
+++ b/test/testsupport/perf_test_unittest.cc
@@ -78,8 +78,8 @@
expected += "RESULT measurementmodifier: trace= 42 units\n";
PrintResult("measurement", "modifier", "trace", 42, "units", false);
- expected += "*RESULT foobar: baz_v= 7 widgets\n";
- PrintResult("foo", "bar", "baz_v", 7, "widgets", true);
+ expected += "*RESULT foobar: baz_v= 1423730 widgets\n";
+ PrintResult("foo", "bar", "baz_v", 1423730, "widgets", true);
expected += "RESULT foobar: baz_me= {1,2} lemurs\n";
PrintResultMeanAndError("foo", "bar", "baz_me", 1, 2, "lemurs", false);