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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 if (plot_information_[i].plot && | 117 if (plot_information_[i].plot && |
118 now_ms_ - plot_information_[i].last_plot_ms >= | 118 now_ms_ - plot_information_[i].last_plot_ms >= |
119 plot_information_[i].plot_interval_ms) { | 119 plot_information_[i].plot_interval_ms) { |
120 PlotDynamics(i); | 120 PlotDynamics(i); |
121 } | 121 } |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 void MetricRecorder::PlotDynamics(int metric) { | 125 void MetricRecorder::PlotDynamics(int metric) { |
126 if (metric == kTotalAvailable) { | 126 if (metric == kTotalAvailable) { |
127 BWE_TEST_LOGGING_PLOT_WITH_NAME( | 127 BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC( |
128 0, plot_information_[kTotalAvailable].prefix, now_ms_, | 128 0, plot_information_[kTotalAvailable].prefix, now_ms_, |
129 GetTotalAvailableKbps(), "Available"); | 129 GetTotalAvailableKbps(), flow_id_, "Available"); |
130 } else if (metric == kAvailablePerFlow) { | 130 } else if (metric == kAvailablePerFlow) { |
131 BWE_TEST_LOGGING_PLOT_WITH_NAME( | 131 BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC( |
132 0, plot_information_[kAvailablePerFlow].prefix, now_ms_, | 132 0, plot_information_[kAvailablePerFlow].prefix, now_ms_, |
133 GetAvailablePerFlowKbps(), "Available_per_flow"); | 133 GetAvailablePerFlowKbps(), flow_id_, "Available_per_flow"); |
134 } else { | 134 } else { |
135 PlotLine(metric, plot_information_[metric].prefix, | 135 PlotLine(metric, plot_information_[metric].prefix, |
136 plot_information_[metric].time_ms, | 136 plot_information_[metric].time_ms, |
137 plot_information_[metric].value); | 137 plot_information_[metric].value); |
138 } | 138 } |
139 plot_information_[metric].last_plot_ms = now_ms_; | 139 plot_information_[metric].last_plot_ms = now_ms_; |
140 } | 140 } |
141 | 141 |
142 template <typename T> | 142 template <typename T> |
143 void MetricRecorder::PlotLine(int windows_id, | 143 void MetricRecorder::PlotLine(int windows_id, |
144 const std::string& prefix, | 144 const std::string& prefix, |
145 int64_t time_ms, | 145 int64_t time_ms, |
146 T y) { | 146 T y) { |
147 BWE_TEST_LOGGING_PLOT_WITH_NAME(windows_id, prefix, time_ms, | 147 BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC(windows_id, prefix, time_ms, |
148 static_cast<double>(y), algorithm_name_); | 148 static_cast<double>(y), flow_id_, |
| 149 algorithm_name_); |
149 } | 150 } |
150 | 151 |
151 void MetricRecorder::UpdateTimeMs(int64_t time_ms) { | 152 void MetricRecorder::UpdateTimeMs(int64_t time_ms) { |
152 now_ms_ = std::max(now_ms_, time_ms); | 153 now_ms_ = std::max(now_ms_, time_ms); |
153 } | 154 } |
154 | 155 |
155 void MetricRecorder::UpdateThroughput(int64_t bitrate_kbps, | 156 void MetricRecorder::UpdateThroughput(int64_t bitrate_kbps, |
156 size_t payload_size) { | 157 size_t payload_size) { |
157 // Total throughput should be computed before updating the time. | 158 // Total throughput should be computed before updating the time. |
158 PushThroughputBytes(payload_size, now_ms_); | 159 PushThroughputBytes(payload_size, now_ms_); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 const std::string& bwe_name, | 349 const std::string& bwe_name, |
349 size_t num_flows) const { | 350 size_t num_flows) const { |
350 BWE_TEST_LOGGING_LABEL(7, title, "objective_function", num_flows); | 351 BWE_TEST_LOGGING_LABEL(7, title, "objective_function", num_flows); |
351 BWE_TEST_LOGGING_BAR(7, bwe_name, ObjectiveFunction(), flow_id_); | 352 BWE_TEST_LOGGING_BAR(7, bwe_name, ObjectiveFunction(), flow_id_); |
352 } | 353 } |
353 | 354 |
354 void MetricRecorder::PlotZero() { | 355 void MetricRecorder::PlotZero() { |
355 for (int i = kThroughput; i <= kLoss; ++i) { | 356 for (int i = kThroughput; i <= kLoss; ++i) { |
356 if (plot_information_[i].plot) { | 357 if (plot_information_[i].plot) { |
357 std::stringstream prefix; | 358 std::stringstream prefix; |
| 359 // TODO(terelius): Since this does not use the BWE_TEST_LOGGING macros, |
| 360 // it hasn't been kept up to date with the plot format. Remove or fix? |
358 prefix << "Receiver_" << flow_id_ << "_" + plot_information_[i].prefix; | 361 prefix << "Receiver_" << flow_id_ << "_" + plot_information_[i].prefix; |
359 PlotLine(i, prefix.str(), now_ms_, 0); | 362 PlotLine(i, prefix.str(), now_ms_, 0); |
360 plot_information_[i].last_plot_ms = now_ms_; | 363 plot_information_[i].last_plot_ms = now_ms_; |
361 } | 364 } |
362 } | 365 } |
363 } | 366 } |
364 | 367 |
365 void MetricRecorder::PauseFlow() { | 368 void MetricRecorder::PauseFlow() { |
366 PlotZero(); | 369 PlotZero(); |
367 link_share_->PauseFlow(flow_id_); | 370 link_share_->PauseFlow(flow_id_); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 439 |
437 double throughput_metric = U(sum_throughput_bytes_, kAlpha); | 440 double throughput_metric = U(sum_throughput_bytes_, kAlpha); |
438 double delay_penalty = kDelta * U(sum_delays_ms_, kBeta); | 441 double delay_penalty = kDelta * U(sum_delays_ms_, kBeta); |
439 | 442 |
440 return throughput_metric - delay_penalty; | 443 return throughput_metric - delay_penalty; |
441 } | 444 } |
442 | 445 |
443 } // namespace bwe | 446 } // namespace bwe |
444 } // namespace testing | 447 } // namespace testing |
445 } // namespace webrtc | 448 } // namespace webrtc |
OLD | NEW |