OLD | NEW |
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 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 const double kBeta = 1.0; | 295 const double kBeta = 1.0; |
296 | 296 |
297 double throughput_metric = U(Sum(throughput_bytes_), kAlpha); | 297 double throughput_metric = U(Sum(throughput_bytes_), kAlpha); |
298 double delay_penalty = kDelta * U(Sum(delays_ms_), kBeta); | 298 double delay_penalty = kDelta * U(Sum(delays_ms_), kBeta); |
299 | 299 |
300 return throughput_metric - delay_penalty; | 300 return throughput_metric - delay_penalty; |
301 } | 301 } |
302 | 302 |
303 void MetricRecorder::PlotThroughputHistogram(const std::string& title, | 303 void MetricRecorder::PlotThroughputHistogram(const std::string& title, |
304 const std::string& bwe_name, | 304 const std::string& bwe_name, |
305 int num_flows, | 305 size_t num_flows, |
306 int64_t extra_offset_ms, | 306 int64_t extra_offset_ms, |
307 const std::string optimum_id) { | 307 const std::string optimum_id) { |
308 size_t num_packets_received = delays_ms_.size(); | 308 size_t num_packets_received = delays_ms_.size(); |
309 | 309 |
310 int64_t duration_ms = now_ms_ - start_computing_metrics_ms_ - extra_offset_ms; | 310 int64_t duration_ms = now_ms_ - start_computing_metrics_ms_ - extra_offset_ms; |
311 | 311 |
312 double average_bitrate_kbps = | 312 double average_bitrate_kbps = |
313 static_cast<double>(8 * Sum(throughput_bytes_) / duration_ms); | 313 static_cast<double>(8 * Sum(throughput_bytes_) / duration_ms); |
314 | 314 |
315 double optimal_bitrate_per_flow_kbps = | 315 double optimal_bitrate_per_flow_kbps = |
(...skipping 24 matching lines...) Expand all Loading... |
340 optimal_bitrate_per_flow_kbps); | 340 optimal_bitrate_per_flow_kbps); |
341 | 341 |
342 RTC_UNUSED(p_error); | 342 RTC_UNUSED(p_error); |
343 RTC_UNUSED(n_error); | 343 RTC_UNUSED(n_error); |
344 RTC_UNUSED(extra_error); | 344 RTC_UNUSED(extra_error); |
345 RTC_UNUSED(optimal_bitrate_per_flow_kbps); | 345 RTC_UNUSED(optimal_bitrate_per_flow_kbps); |
346 } | 346 } |
347 | 347 |
348 void MetricRecorder::PlotThroughputHistogram(const std::string& title, | 348 void MetricRecorder::PlotThroughputHistogram(const std::string& title, |
349 const std::string& bwe_name, | 349 const std::string& bwe_name, |
350 int num_flows, | 350 size_t num_flows, |
351 int64_t extra_offset_ms) { | 351 int64_t extra_offset_ms) { |
352 PlotThroughputHistogram(title, bwe_name, num_flows, extra_offset_ms, ""); | 352 PlotThroughputHistogram(title, bwe_name, num_flows, extra_offset_ms, ""); |
353 } | 353 } |
354 | 354 |
355 void MetricRecorder::PlotDelayHistogram(const std::string& title, | 355 void MetricRecorder::PlotDelayHistogram(const std::string& title, |
356 const std::string& bwe_name, | 356 const std::string& bwe_name, |
357 int num_flows, | 357 size_t num_flows, |
358 int64_t one_way_path_delay_ms) { | 358 int64_t one_way_path_delay_ms) { |
359 size_t num_packets_received = delays_ms_.size(); | 359 size_t num_packets_received = delays_ms_.size(); |
360 double average_delay_ms = Average(delays_ms_, num_packets_received); | 360 double average_delay_ms = Average(delays_ms_, num_packets_received); |
361 | 361 |
362 // Prevent the error to be too close to zero (plotting issue). | 362 // Prevent the error to be too close to zero (plotting issue). |
363 double extra_error = average_delay_ms / 500; | 363 double extra_error = average_delay_ms / 500; |
364 | 364 |
365 double tenth_sigma_ms = | 365 double tenth_sigma_ms = |
366 StandardDeviation(delays_ms_, num_packets_received) / 10.0 + extra_error; | 366 StandardDeviation(delays_ms_, num_packets_received) / 10.0 + extra_error; |
367 | 367 |
(...skipping 20 matching lines...) Expand all Loading... |
388 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 95th percentile : ", | 388 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Delay 95th percentile : ", |
389 "%ld ms", percentile_95_ms - one_way_path_delay_ms); | 389 "%ld ms", percentile_95_ms - one_way_path_delay_ms); |
390 | 390 |
391 RTC_UNUSED(tenth_sigma_ms); | 391 RTC_UNUSED(tenth_sigma_ms); |
392 RTC_UNUSED(percentile_5_ms); | 392 RTC_UNUSED(percentile_5_ms); |
393 RTC_UNUSED(percentile_95_ms); | 393 RTC_UNUSED(percentile_95_ms); |
394 } | 394 } |
395 | 395 |
396 void MetricRecorder::PlotLossHistogram(const std::string& title, | 396 void MetricRecorder::PlotLossHistogram(const std::string& title, |
397 const std::string& bwe_name, | 397 const std::string& bwe_name, |
398 int num_flows, | 398 size_t num_flows, |
399 float global_loss_ratio) { | 399 float global_loss_ratio) { |
400 BWE_TEST_LOGGING_LABEL(6, title, "packet_loss_ratio_(%)", num_flows) | 400 BWE_TEST_LOGGING_LABEL(6, title, "packet_loss_ratio_(%)", num_flows) |
401 BWE_TEST_LOGGING_BAR(6, bwe_name, 100.0f * global_loss_ratio, flow_id_); | 401 BWE_TEST_LOGGING_BAR(6, bwe_name, 100.0f * global_loss_ratio, flow_id_); |
402 | 402 |
403 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Loss Ratio : ", "%f %%", | 403 BWE_TEST_LOGGING_LOG1("RESULTS >>> " + bwe_name + " Loss Ratio : ", "%f %%", |
404 100.0f * global_loss_ratio); | 404 100.0f * global_loss_ratio); |
405 } | 405 } |
406 | 406 |
407 void MetricRecorder::PlotObjectiveHistogram(const std::string& title, | 407 void MetricRecorder::PlotObjectiveHistogram(const std::string& title, |
408 const std::string& bwe_name, | 408 const std::string& bwe_name, |
409 int num_flows) { | 409 size_t num_flows) { |
410 BWE_TEST_LOGGING_LABEL(7, title, "objective_function", num_flows) | 410 BWE_TEST_LOGGING_LABEL(7, title, "objective_function", num_flows) |
411 BWE_TEST_LOGGING_BAR(7, bwe_name, ObjectiveFunction(), flow_id_); | 411 BWE_TEST_LOGGING_BAR(7, bwe_name, ObjectiveFunction(), flow_id_); |
412 } | 412 } |
413 | 413 |
414 void MetricRecorder::PlotZero() { | 414 void MetricRecorder::PlotZero() { |
415 for (int i = kThroughput; i <= kLoss; ++i) { | 415 for (int i = kThroughput; i <= kLoss; ++i) { |
416 if (plot_information_[i].plot) { | 416 if (plot_information_[i].plot) { |
417 std::stringstream prefix; | 417 std::stringstream prefix; |
418 prefix << "Receiver_" << flow_id_ << "_" + plot_information_[i].prefix; | 418 prefix << "Receiver_" << flow_id_ << "_" + plot_information_[i].prefix; |
419 PlotLine(i, prefix.str(), now_ms_, 0); | 419 PlotLine(i, prefix.str(), now_ms_, 0); |
420 plot_information_[i].last_plot_ms = now_ms_; | 420 plot_information_[i].last_plot_ms = now_ms_; |
421 } | 421 } |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 void MetricRecorder::PauseFlow() { | 425 void MetricRecorder::PauseFlow() { |
426 PlotZero(); | 426 PlotZero(); |
427 link_share_->PauseFlow(flow_id_); | 427 link_share_->PauseFlow(flow_id_); |
428 } | 428 } |
429 | 429 |
430 void MetricRecorder::ResumeFlow(int64_t paused_time_ms) { | 430 void MetricRecorder::ResumeFlow(int64_t paused_time_ms) { |
431 UpdateTime(now_ms_ + paused_time_ms); | 431 UpdateTime(now_ms_ + paused_time_ms); |
432 PlotZero(); | 432 PlotZero(); |
433 link_share_->ResumeFlow(flow_id_); | 433 link_share_->ResumeFlow(flow_id_); |
434 } | 434 } |
435 | 435 |
436 } // namespace bwe | 436 } // namespace bwe |
437 } // namespace testing | 437 } // namespace testing |
438 } // namespace webrtc | 438 } // namespace webrtc |
OLD | NEW |