Output 0 instead of NaN in perftest-output.json
Subsequent recipe step requires the json to be valid. TBR: terelius@webrtc.org No-Try: True Bug: webrtc:9767 Change-Id: I1b7457a147039772e2cb4dbdbc0eab3e699492be Reviewed-on: https://webrtc-review.googlesource.com/101260 Reviewed-by: Oleh Prypin <oprypin@webrtc.org> Commit-Queue: Oleh Prypin <oprypin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24782}
This commit is contained in:
@ -27,6 +27,10 @@ using std::vector;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const int kQuickTestTimeoutMs = 500;
|
const int kQuickTestTimeoutMs = 500;
|
||||||
|
|
||||||
|
double SafeDiv(double a, double b) {
|
||||||
|
return b ? a / b : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -217,12 +221,13 @@ void BweTest::PrintResults(double max_throughput_kbps,
|
|||||||
Stats<double> throughput_kbps,
|
Stats<double> throughput_kbps,
|
||||||
std::map<int, Stats<double>> flow_delay_ms,
|
std::map<int, Stats<double>> flow_delay_ms,
|
||||||
std::map<int, Stats<double>> flow_throughput_kbps) {
|
std::map<int, Stats<double>> flow_throughput_kbps) {
|
||||||
double utilization = throughput_kbps.GetMean() / max_throughput_kbps;
|
double utilization = SafeDiv(throughput_kbps.GetMean(), max_throughput_kbps);
|
||||||
webrtc::test::PrintResult("BwePerformance", GetTestName(), "Utilization",
|
webrtc::test::PrintResult("BwePerformance", GetTestName(), "Utilization",
|
||||||
utilization * 100.0, "%", false);
|
utilization * 100.0, "%", false);
|
||||||
webrtc::test::PrintResult(
|
webrtc::test::PrintResult(
|
||||||
"BwePerformance", GetTestName(), "Utilization var coeff",
|
"BwePerformance", GetTestName(), "Utilization var coeff",
|
||||||
throughput_kbps.GetStdDev() / throughput_kbps.GetMean(), "", false);
|
SafeDiv(throughput_kbps.GetStdDev(), throughput_kbps.GetMean()), "",
|
||||||
|
false);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
for (auto& kv : flow_throughput_kbps) {
|
for (auto& kv : flow_throughput_kbps) {
|
||||||
ss.str("");
|
ss.str("");
|
||||||
@ -246,8 +251,8 @@ void BweTest::PrintResults(double max_throughput_kbps,
|
|||||||
squared_bitrate_sum += kv.second.GetMean() * kv.second.GetMean();
|
squared_bitrate_sum += kv.second.GetMean() * kv.second.GetMean();
|
||||||
fairness_index += kv.second.GetMean();
|
fairness_index += kv.second.GetMean();
|
||||||
}
|
}
|
||||||
fairness_index *= fairness_index;
|
fairness_index *= SafeDiv(
|
||||||
fairness_index /= flow_throughput_kbps.size() * squared_bitrate_sum;
|
fairness_index, flow_throughput_kbps.size() * squared_bitrate_sum);
|
||||||
}
|
}
|
||||||
webrtc::test::PrintResult("BwePerformance", GetTestName(), "Fairness",
|
webrtc::test::PrintResult("BwePerformance", GetTestName(), "Fairness",
|
||||||
fairness_index * 100, "%", false);
|
fairness_index * 100, "%", false);
|
||||||
|
|||||||
Reference in New Issue
Block a user