Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc

Issue 2684613002: Delete webrtc/base/common.h (Closed)
Patch Set: Added TODO comment. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" 11 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "webrtc/base/common.h"
16 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h" 15 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
17 16
18 namespace webrtc { 17 namespace webrtc {
19 namespace testing { 18 namespace testing {
20 namespace bwe { 19 namespace bwe {
21 20
22 namespace { 21 namespace {
23 // Holder mean, Manhattan distance for p=1, EuclidianNorm/sqrt(n) for p=2. 22 // Holder mean, Manhattan distance for p=1, EuclidianNorm/sqrt(n) for p=2.
24 template <typename T> 23 template <typename T>
25 double NormLp(T sum, size_t size, double p) { 24 double NormLp(T sum, size_t size, double p) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return false; 255 return false;
257 } 256 }
258 } 257 }
259 258
260 void MetricRecorder::PlotThroughputHistogram( 259 void MetricRecorder::PlotThroughputHistogram(
261 const std::string& title, 260 const std::string& title,
262 const std::string& bwe_name, 261 const std::string& bwe_name,
263 size_t num_flows, 262 size_t num_flows,
264 int64_t extra_offset_ms, 263 int64_t extra_offset_ms,
265 const std::string optimum_id) const { 264 const std::string optimum_id) const {
265 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
266 double optimal_bitrate_per_flow_kbps = static_cast<double>( 266 double optimal_bitrate_per_flow_kbps = static_cast<double>(
267 optimal_throughput_bits_ / RunDurationMs(extra_offset_ms)); 267 optimal_throughput_bits_ / RunDurationMs(extra_offset_ms));
268 268
269 double neg_error = Renormalize( 269 double neg_error = Renormalize(
270 NormLp(sum_lp_weighted_estimate_error_[0], num_packets_received_, kP)); 270 NormLp(sum_lp_weighted_estimate_error_[0], num_packets_received_, kP));
271 double pos_error = Renormalize( 271 double pos_error = Renormalize(
272 NormLp(sum_lp_weighted_estimate_error_[1], num_packets_received_, kP)); 272 NormLp(sum_lp_weighted_estimate_error_[1], num_packets_received_, kP));
273 273
274 double average_bitrate_kbps = AverageBitrateKbps(extra_offset_ms); 274 double average_bitrate_kbps = AverageBitrateKbps(extra_offset_ms);
275 275
276 // Prevent the error to be too close to zero (plotting issue). 276 // Prevent the error to be too close to zero (plotting issue).
277 double extra_error = average_bitrate_kbps / 500; 277 double extra_error = average_bitrate_kbps / 500;
278 278
279 std::string optimum_title = 279 std::string optimum_title =
280 optimum_id.empty() ? "optimal_bitrate" : "optimal_bitrates#" + optimum_id; 280 optimum_id.empty() ? "optimal_bitrate" : "optimal_bitrates#" + optimum_id;
281 281
282 BWE_TEST_LOGGING_LABEL(4, title, "average_bitrate_(kbps)", num_flows); 282 BWE_TEST_LOGGING_LABEL(4, title, "average_bitrate_(kbps)", num_flows);
283 BWE_TEST_LOGGING_LIMITERRORBAR( 283 BWE_TEST_LOGGING_LIMITERRORBAR(
284 4, bwe_name, average_bitrate_kbps, 284 4, bwe_name, average_bitrate_kbps,
285 average_bitrate_kbps - neg_error - extra_error, 285 average_bitrate_kbps - neg_error - extra_error,
286 average_bitrate_kbps + pos_error + extra_error, "estimate_error", 286 average_bitrate_kbps + pos_error + extra_error, "estimate_error",
287 optimal_bitrate_per_flow_kbps, optimum_title, flow_id_); 287 optimal_bitrate_per_flow_kbps, optimum_title, flow_id_);
288 288
289 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Channel utilization : ", 289 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Channel utilization : ",
290 "%lf %%", 290 "%lf %%",
291 100.0 * static_cast<double>(average_bitrate_kbps) / 291 100.0 * static_cast<double>(average_bitrate_kbps) /
292 optimal_bitrate_per_flow_kbps); 292 optimal_bitrate_per_flow_kbps);
293 293 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
294 RTC_UNUSED(pos_error);
295 RTC_UNUSED(neg_error);
296 RTC_UNUSED(extra_error);
297 RTC_UNUSED(optimal_bitrate_per_flow_kbps);
298 } 294 }
299 295
300 void MetricRecorder::PlotThroughputHistogram(const std::string& title, 296 void MetricRecorder::PlotThroughputHistogram(const std::string& title,
301 const std::string& bwe_name, 297 const std::string& bwe_name,
302 size_t num_flows, 298 size_t num_flows,
303 int64_t extra_offset_ms) const { 299 int64_t extra_offset_ms) const {
304 PlotThroughputHistogram(title, bwe_name, num_flows, extra_offset_ms, ""); 300 PlotThroughputHistogram(title, bwe_name, num_flows, extra_offset_ms, "");
305 } 301 }
306 302
307 void MetricRecorder::PlotDelayHistogram(const std::string& title, 303 void MetricRecorder::PlotDelayHistogram(const std::string& title,
308 const std::string& bwe_name, 304 const std::string& bwe_name,
309 size_t num_flows, 305 size_t num_flows,
310 int64_t one_way_path_delay_ms) const { 306 int64_t one_way_path_delay_ms) const {
307 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
311 double average_delay_ms = 308 double average_delay_ms =
312 static_cast<double>(sum_delays_ms_) / num_packets_received_; 309 static_cast<double>(sum_delays_ms_) / num_packets_received_;
313 310
314 // Prevent the error to be too close to zero (plotting issue). 311 // Prevent the error to be too close to zero (plotting issue).
315 double extra_error = average_delay_ms / 500; 312 double extra_error = average_delay_ms / 500;
316 double tenth_sigma_ms = DelayStdDev() / 10.0 + extra_error; 313 double tenth_sigma_ms = DelayStdDev() / 10.0 + extra_error;
317 int64_t percentile_5_ms = NthDelayPercentile(5); 314 int64_t percentile_5_ms = NthDelayPercentile(5);
318 int64_t percentile_95_ms = NthDelayPercentile(95); 315 int64_t percentile_95_ms = NthDelayPercentile(95);
319 316
320 BWE_TEST_LOGGING_LABEL(5, title, "average_delay_(ms)", num_flows); 317 BWE_TEST_LOGGING_LABEL(5, title, "average_delay_(ms)", num_flows);
321 BWE_TEST_LOGGING_ERRORBAR(5, bwe_name, average_delay_ms, percentile_5_ms, 318 BWE_TEST_LOGGING_ERRORBAR(5, bwe_name, average_delay_ms, percentile_5_ms,
322 percentile_95_ms, "5th and 95th percentiles", 319 percentile_95_ms, "5th and 95th percentiles",
323 flow_id_); 320 flow_id_);
324 321
325 // Log added latency, disregard baseline path delay. 322 // Log added latency, disregard baseline path delay.
326 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay average : ", 323 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay average : ",
327 "%lf ms", average_delay_ms - one_way_path_delay_ms); 324 "%lf ms", average_delay_ms - one_way_path_delay_ms);
328 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 5th percentile : ", 325 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 5th percentile : ",
329 "%ld ms", percentile_5_ms - one_way_path_delay_ms); 326 "%ld ms", percentile_5_ms - one_way_path_delay_ms);
330 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 95th percentile : ", 327 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 95th percentile : ",
331 "%ld ms", percentile_95_ms - one_way_path_delay_ms); 328 "%ld ms", percentile_95_ms - one_way_path_delay_ms);
332 329 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
333 RTC_UNUSED(tenth_sigma_ms);
334 RTC_UNUSED(percentile_5_ms);
335 RTC_UNUSED(percentile_95_ms);
336 } 330 }
337 331
338 void MetricRecorder::PlotLossHistogram(const std::string& title, 332 void MetricRecorder::PlotLossHistogram(const std::string& title,
339 const std::string& bwe_name, 333 const std::string& bwe_name,
340 size_t num_flows, 334 size_t num_flows,
341 float global_loss_ratio) const { 335 float global_loss_ratio) const {
342 BWE_TEST_LOGGING_LABEL(6, title, "packet_loss_ratio_(%)", num_flows); 336 BWE_TEST_LOGGING_LABEL(6, title, "packet_loss_ratio_(%)", num_flows);
343 BWE_TEST_LOGGING_BAR(6, bwe_name, 100.0f * global_loss_ratio, flow_id_); 337 BWE_TEST_LOGGING_BAR(6, bwe_name, 100.0f * global_loss_ratio, flow_id_);
344 338
345 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Loss Ratio : ", "%f %%", 339 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Loss Ratio : ", "%f %%",
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 434
441 double throughput_metric = U(sum_throughput_bytes_, kAlpha); 435 double throughput_metric = U(sum_throughput_bytes_, kAlpha);
442 double delay_penalty = kDelta * U(sum_delays_ms_, kBeta); 436 double delay_penalty = kDelta * U(sum_delays_ms_, kBeta);
443 437
444 return throughput_metric - delay_penalty; 438 return throughput_metric - delay_penalty;
445 } 439 }
446 440
447 } // namespace bwe 441 } // namespace bwe
448 } // namespace testing 442 } // namespace testing
449 } // namespace webrtc 443 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc ('k') | webrtc/pc/mediasession.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698