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

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

Issue 2756483002: Use RTC_UNUSED instead of conditional compilation in BWE simulator tool. (Closed)
Patch Set: Attempt static_cast<void>(x) Created 3 years, 9 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
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc ('k') | webrtc/typedefs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/modules/remote_bitrate_estimator/test/packet_sender.h" 15 #include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
16 #include "webrtc/typedefs.h"
16 17
17 namespace webrtc { 18 namespace webrtc {
18 namespace testing { 19 namespace testing {
19 namespace bwe { 20 namespace bwe {
20 21
21 namespace { 22 namespace {
22 // Holder mean, Manhattan distance for p=1, EuclidianNorm/sqrt(n) for p=2. 23 // Holder mean, Manhattan distance for p=1, EuclidianNorm/sqrt(n) for p=2.
23 template <typename T> 24 template <typename T>
24 double NormLp(T sum, size_t size, double p) { 25 double NormLp(T sum, size_t size, double p) {
25 return pow(sum / size, 1.0 / p); 26 return pow(sum / size, 1.0 / p);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return false; 256 return false;
256 } 257 }
257 } 258 }
258 259
259 void MetricRecorder::PlotThroughputHistogram( 260 void MetricRecorder::PlotThroughputHistogram(
260 const std::string& title, 261 const std::string& title,
261 const std::string& bwe_name, 262 const std::string& bwe_name,
262 size_t num_flows, 263 size_t num_flows,
263 int64_t extra_offset_ms, 264 int64_t extra_offset_ms,
264 const std::string optimum_id) const { 265 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 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE 293
294 RTC_UNUSED(pos_error);
295 RTC_UNUSED(neg_error);
296 RTC_UNUSED(extra_error);
297 RTC_UNUSED(optimal_bitrate_per_flow_kbps);
294 } 298 }
295 299
296 void MetricRecorder::PlotThroughputHistogram(const std::string& title, 300 void MetricRecorder::PlotThroughputHistogram(const std::string& title,
297 const std::string& bwe_name, 301 const std::string& bwe_name,
298 size_t num_flows, 302 size_t num_flows,
299 int64_t extra_offset_ms) const { 303 int64_t extra_offset_ms) const {
300 PlotThroughputHistogram(title, bwe_name, num_flows, extra_offset_ms, ""); 304 PlotThroughputHistogram(title, bwe_name, num_flows, extra_offset_ms, "");
301 } 305 }
302 306
303 void MetricRecorder::PlotDelayHistogram(const std::string& title, 307 void MetricRecorder::PlotDelayHistogram(const std::string& title,
304 const std::string& bwe_name, 308 const std::string& bwe_name,
305 size_t num_flows, 309 size_t num_flows,
306 int64_t one_way_path_delay_ms) const { 310 int64_t one_way_path_delay_ms) const {
307 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
308 double average_delay_ms = 311 double average_delay_ms =
309 static_cast<double>(sum_delays_ms_) / num_packets_received_; 312 static_cast<double>(sum_delays_ms_) / num_packets_received_;
310 int64_t percentile_5_ms = NthDelayPercentile(5); 313 int64_t percentile_5_ms = NthDelayPercentile(5);
311 int64_t percentile_95_ms = NthDelayPercentile(95); 314 int64_t percentile_95_ms = NthDelayPercentile(95);
312 315
313 BWE_TEST_LOGGING_LABEL(5, title, "average_delay_(ms)", num_flows); 316 BWE_TEST_LOGGING_LABEL(5, title, "average_delay_(ms)", num_flows);
314 BWE_TEST_LOGGING_ERRORBAR(5, bwe_name, average_delay_ms, percentile_5_ms, 317 BWE_TEST_LOGGING_ERRORBAR(5, bwe_name, average_delay_ms, percentile_5_ms,
315 percentile_95_ms, "5th and 95th percentiles", 318 percentile_95_ms, "5th and 95th percentiles",
316 flow_id_); 319 flow_id_);
317 320
318 // Log added latency, disregard baseline path delay. 321 // Log added latency, disregard baseline path delay.
319 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay average : ", 322 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay average : ",
320 "%lf ms", average_delay_ms - one_way_path_delay_ms); 323 "%lf ms", average_delay_ms - one_way_path_delay_ms);
321 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 5th percentile : ", 324 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 5th percentile : ",
322 "%ld ms", percentile_5_ms - one_way_path_delay_ms); 325 "%ld ms", percentile_5_ms - one_way_path_delay_ms);
323 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 95th percentile : ", 326 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 95th percentile : ",
324 "%ld ms", percentile_95_ms - one_way_path_delay_ms); 327 "%ld ms", percentile_95_ms - one_way_path_delay_ms);
325 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE 328
329 RTC_UNUSED(average_delay_ms);
330 RTC_UNUSED(percentile_5_ms);
331 RTC_UNUSED(percentile_95_ms);
326 } 332 }
327 333
328 void MetricRecorder::PlotLossHistogram(const std::string& title, 334 void MetricRecorder::PlotLossHistogram(const std::string& title,
329 const std::string& bwe_name, 335 const std::string& bwe_name,
330 size_t num_flows, 336 size_t num_flows,
331 float global_loss_ratio) const { 337 float global_loss_ratio) const {
332 BWE_TEST_LOGGING_LABEL(6, title, "packet_loss_ratio_(%)", num_flows); 338 BWE_TEST_LOGGING_LABEL(6, title, "packet_loss_ratio_(%)", num_flows);
333 BWE_TEST_LOGGING_BAR(6, bwe_name, 100.0f * global_loss_ratio, flow_id_); 339 BWE_TEST_LOGGING_BAR(6, bwe_name, 100.0f * global_loss_ratio, flow_id_);
334 340
335 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Loss Ratio : ", "%f %%", 341 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Loss Ratio : ", "%f %%",
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 436
431 double throughput_metric = U(sum_throughput_bytes_, kAlpha); 437 double throughput_metric = U(sum_throughput_bytes_, kAlpha);
432 double delay_penalty = kDelta * U(sum_delays_ms_, kBeta); 438 double delay_penalty = kDelta * U(sum_delays_ms_, kBeta);
433 439
434 return throughput_metric - delay_penalty; 440 return throughput_metric - delay_penalty;
435 } 441 }
436 442
437 } // namespace bwe 443 } // namespace bwe
438 } // namespace testing 444 } // namespace testing
439 } // namespace webrtc 445 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc ('k') | webrtc/typedefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698