Make PrintResultMeanAndError receive two doubles instead of a string.

Bug: webrtc:8566
Change-Id: Ida925b030bff24275d34c0e888ee362e94c46b21
Reviewed-on: https://webrtc-review.googlesource.com/25540
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20866}
diff --git a/modules/audio_processing/audio_processing_performance_unittest.cc b/modules/audio_processing/audio_processing_performance_unittest.cc
index 7a3670f..51d4a91 100644
--- a/modules/audio_processing/audio_processing_performance_unittest.cc
+++ b/modules/audio_processing/audio_processing_performance_unittest.cc
@@ -260,22 +260,12 @@
   void print_processor_statistics(const std::string& processor_name) const {
     const std::string modifier = "_api_call_duration";
 
-    // Lambda function for creating a test printout string.
-    auto create_mean_and_std_string = [](int64_t average,
-                                         int64_t standard_dev) {
-      std::string s = std::to_string(average);
-      s += ", ";
-      s += std::to_string(standard_dev);
-      return s;
-    };
-
     const std::string sample_rate_name =
         "_" + std::to_string(simulation_config_->sample_rate_hz) + "Hz";
 
     webrtc::test::PrintResultMeanAndError(
         "apm_timing", sample_rate_name, processor_name,
-        create_mean_and_std_string(GetDurationAverage(),
-                                   GetDurationStandardDeviation()),
+        GetDurationAverage(), GetDurationStandardDeviation(),
         "us", false);
 
     if (kPrintAllDurations) {
diff --git a/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc b/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc
index 9aa10de..7d61cff 100644
--- a/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc
+++ b/modules/audio_processing/level_controller/level_controller_complexity_unittest.cc
@@ -32,13 +32,6 @@
 const size_t kToTalNumFrames =
     kNumFramesToProcess + kNumFramesToProcessAtWarmup;
 
-std::string FormPerformanceMeasureString(const test::PerformanceTimer& timer) {
-  std::string s = std::to_string(timer.GetDurationAverage());
-  s += ", ";
-  s += std::to_string(timer.GetDurationStandardDeviation());
-  return s;
-}
-
 void RunStandaloneSubmodule(int sample_rate_hz, size_t num_channels) {
   test::SimulatorBuffers buffers(sample_rate_hz, sample_rate_hz, sample_rate_hz,
                                  sample_rate_hz, num_channels, num_channels,
@@ -63,8 +56,8 @@
       "level_controller_call_durations",
       "_" + std::to_string(sample_rate_hz) + "Hz_" +
           std::to_string(num_channels) + "_channels",
-      "StandaloneLevelControl", FormPerformanceMeasureString(timer), "us",
-      false);
+      "StandaloneLevelControl", timer.GetDurationAverage(),
+      timer.GetDurationStandardDeviation(), "us", false);
 }
 
 void RunTogetherWithApm(const std::string& test_description,
@@ -164,8 +157,8 @@
           std::to_string(capture_input_sample_rate_hz) + "_" +
           std::to_string(capture_output_sample_rate_hz) + "Hz_" +
           std::to_string(num_channels) + "_channels" + "_render",
-      test_description, FormPerformanceMeasureString(render_timer), "us",
-      false);
+      test_description, render_timer.GetDurationAverage(),
+      render_timer.GetDurationStandardDeviation(), "us", false);
   webrtc::test::PrintResultMeanAndError(
       "level_controller_call_durations",
       "_" + std::to_string(render_input_sample_rate_hz) + "_" +
@@ -173,8 +166,8 @@
           std::to_string(capture_input_sample_rate_hz) + "_" +
           std::to_string(capture_output_sample_rate_hz) + "Hz_" +
           std::to_string(num_channels) + "_channels" + "_capture",
-      test_description, FormPerformanceMeasureString(capture_timer), "us",
-      false);
+      test_description, capture_timer.GetDurationAverage(),
+      capture_timer.GetDurationStandardDeviation(), "us", false);
   webrtc::test::PrintResultMeanAndError(
       "level_controller_call_durations",
       "_" + std::to_string(render_input_sample_rate_hz) + "_" +
@@ -182,7 +175,8 @@
           std::to_string(capture_input_sample_rate_hz) + "_" +
           std::to_string(capture_output_sample_rate_hz) + "Hz_" +
           std::to_string(num_channels) + "_channels" + "_total",
-      test_description, FormPerformanceMeasureString(total_timer), "us", false);
+      test_description, total_timer.GetDurationAverage(),
+      total_timer.GetDurationStandardDeviation(), "us", false);
 }
 
 }  // namespace
diff --git a/modules/audio_processing/residual_echo_detector_complexity_unittest.cc b/modules/audio_processing/residual_echo_detector_complexity_unittest.cc
index 991b9ff..d829703 100644
--- a/modules/audio_processing/residual_echo_detector_complexity_unittest.cc
+++ b/modules/audio_processing/residual_echo_detector_complexity_unittest.cc
@@ -37,16 +37,6 @@
 constexpr int kSampleRate = AudioProcessing::kSampleRate48kHz;
 constexpr int kNumberOfChannels = 1;
 
-std::string FormPerformanceMeasureString(const test::PerformanceTimer& timer,
-                                         int number_of_warmup_samples) {
-  std::string s =
-      std::to_string(timer.GetDurationAverage(number_of_warmup_samples));
-  s += ", ";
-  s += std::to_string(
-      timer.GetDurationStandardDeviation(number_of_warmup_samples));
-  return s;
-}
-
 void RunStandaloneSubmodule() {
   test::SimulatorBuffers buffers(
       kSampleRate, kSampleRate, kSampleRate, kSampleRate, kNumberOfChannels,
@@ -84,8 +74,8 @@
   EXPECT_EQ(0.0f, sum);
   webrtc::test::PrintResultMeanAndError(
       "echo_detector_call_durations", "", "StandaloneEchoDetector",
-      FormPerformanceMeasureString(timer,
-                                   kNumberOfWarmupMeasurementsStandalone),
+      timer.GetDurationAverage(kNumberOfWarmupMeasurementsStandalone),
+      timer.GetDurationStandardDeviation(kNumberOfWarmupMeasurementsStandalone),
       "us", false);
 }
 
@@ -168,7 +158,8 @@
 
   webrtc::test::PrintResultMeanAndError(
       "echo_detector_call_durations", "_total", test_description,
-      FormPerformanceMeasureString(timer, kNumberOfWarmupMeasurements), "us",
+      timer.GetDurationAverage(kNumberOfWarmupMeasurements),
+      timer.GetDurationStandardDeviation(kNumberOfWarmupMeasurements), "us",
       false);
 }
 
diff --git a/modules/remote_bitrate_estimator/test/bwe_test.cc b/modules/remote_bitrate_estimator/test/bwe_test.cc
index f5fe38e..71088ff 100644
--- a/modules/remote_bitrate_estimator/test/bwe_test.cc
+++ b/modules/remote_bitrate_estimator/test/bwe_test.cc
@@ -225,15 +225,15 @@
     ss.str("");
     ss << "Throughput flow " << kv.first;
     webrtc::test::PrintResultMeanAndError("BwePerformance", GetTestName(),
-                                          ss.str(), kv.second.AsString(),
-                                          "kbps", false);
+                                          ss.str(), kv.second.GetMean(),
+                                          kv.second.GetStdDev(), "kbps", false);
   }
   for (auto& kv : flow_delay_ms) {
     ss.str("");
     ss << "Delay flow " << kv.first;
     webrtc::test::PrintResultMeanAndError("BwePerformance", GetTestName(),
-                                          ss.str(), kv.second.AsString(), "ms",
-                                          false);
+                                          ss.str(), kv.second.GetMean(),
+                                          kv.second.GetStdDev(), "ms", false);
   }
   double fairness_index = 1.0;
   if (!flow_throughput_kbps.empty()) {
diff --git a/test/testsupport/perf_test.cc b/test/testsupport/perf_test.cc
index e8608cd..bb4491a 100644
--- a/test/testsupport/perf_test.cc
+++ b/test/testsupport/perf_test.cc
@@ -75,11 +75,14 @@
 void PrintResultMeanAndError(const std::string& measurement,
                              const std::string& modifier,
                              const std::string& trace,
-                             const std::string& mean_and_error,
+                             const double mean,
+                             const double error,
                              const std::string& units,
                              bool important) {
-  PrintResultsImpl(measurement, modifier, trace, mean_and_error,
-                   "{", "}", units, important);
+  std::ostringstream value_stream;
+  value_stream << '{' << mean << ',' << error << '}';
+  PrintResultsImpl(measurement, modifier, trace, value_stream.str(), "", "",
+                   units, important);
 }
 
 void PrintResultList(const std::string& measurement,
diff --git a/test/testsupport/perf_test.h b/test/testsupport/perf_test.h
index 95bbf65..02dd1f3 100644
--- a/test/testsupport/perf_test.h
+++ b/test/testsupport/perf_test.h
@@ -47,7 +47,8 @@
 void PrintResultMeanAndError(const std::string& measurement,
                              const std::string& modifier,
                              const std::string& trace,
-                             const std::string& mean_and_error,
+                             const double mean,
+                             const double error,
                              const std::string& units,
                              bool important);