From cb666f5e03958fb85ecbac6c56eb168e0c955810 Mon Sep 17 00:00:00 2001 From: Edward Lemur Date: Mon, 4 Dec 2017 13:21:01 +0100 Subject: [PATCH] Increase precision when printing perf_results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit-Queue: Edward Lemur Cr-Commit-Position: refs/heads/master@{#21034} --- test/testsupport/perf_test.cc | 3 +++ test/testsupport/perf_test_unittest.cc | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/testsupport/perf_test.cc b/test/testsupport/perf_test.cc index affd45815f..c2a2a502f9 100644 --- a/test/testsupport/perf_test.cc +++ b/test/testsupport/perf_test.cc @@ -55,6 +55,7 @@ class PerfResultsLogger { 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 @@ class PerfResultsLogger { 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 @@ class PerfResultsLogger { 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 f80bcf8bd3..514196b1e9 100644 --- a/test/testsupport/perf_test_unittest.cc +++ b/test/testsupport/perf_test_unittest.cc @@ -78,8 +78,8 @@ TEST_F(PerfTest, MAYBE_TestPrintResult) { 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);