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}
This commit is contained in:
Edward Lemur 2017-11-23 14:06:04 +01:00 committed by Commit Bot
parent 3e189a6dc3
commit f9d303c042
6 changed files with 25 additions and 46 deletions

View file

@ -260,22 +260,12 @@ class TimedThreadApiProcessor {
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) {

View file

@ -32,13 +32,6 @@ const size_t kNumFramesToProcessAtWarmup = 300;
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 @@ void RunStandaloneSubmodule(int sample_rate_hz, size_t num_channels) {
"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 @@ void RunTogetherWithApm(const std::string& test_description,
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 @@ void RunTogetherWithApm(const std::string& test_description,
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 @@ void RunTogetherWithApm(const std::string& test_description,
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

View file

@ -37,16 +37,6 @@ constexpr size_t kNumberOfWarmupMeasurementsStandalone =
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 @@ void RunStandaloneSubmodule() {
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 @@ void RunTogetherWithApm(const std::string& test_description,
webrtc::test::PrintResultMeanAndError(
"echo_detector_call_durations", "_total", test_description,
FormPerformanceMeasureString(timer, kNumberOfWarmupMeasurements), "us",
timer.GetDurationAverage(kNumberOfWarmupMeasurements),
timer.GetDurationStandardDeviation(kNumberOfWarmupMeasurements), "us",
false);
}

View file

@ -225,15 +225,15 @@ void BweTest::PrintResults(double max_throughput_kbps,
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()) {

View file

@ -75,11 +75,14 @@ void PrintResult(const std::string& measurement,
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,

View file

@ -47,7 +47,8 @@ void PrintResult(const std::string& measurement,
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);