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}
This commit is contained in:
Edward Lemur 2017-12-04 13:21:01 +01:00 committed by Commit Bot
parent fbf5a3baa1
commit cb666f5e03
2 changed files with 5 additions and 2 deletions

View File

@ -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 << ']';

View File

@ -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);