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

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

Issue 2456373002: Update BWE_TEST_LOGGING_PLOT output format, and fix plot_dynamics.py script. (Closed)
Patch Set: Suppress warnings about unused variable. Created 4 years, 1 month 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return rate_counter_.packets_per_second(); 210 return rate_counter_.packets_per_second();
211 } 211 }
212 212
213 uint32_t PacketProcessor::bits_per_second() const { 213 uint32_t PacketProcessor::bits_per_second() const {
214 return rate_counter_.bits_per_second(); 214 return rate_counter_.bits_per_second();
215 } 215 }
216 216
217 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener, 217 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
218 int flow_id, 218 int flow_id,
219 const char* name, 219 const char* name,
220 const std::string& plot_name) 220 const std::string& algorithm_name)
221 : PacketProcessor(listener, flow_id, kRegular), 221 : PacketProcessor(listener, flow_id, kRegular),
222 packets_per_second_stats_(), 222 packets_per_second_stats_(),
223 kbps_stats_(), 223 kbps_stats_(),
224 start_plotting_time_ms_(0), 224 start_plotting_time_ms_(0),
225 plot_name_(plot_name) { 225 flow_id_(flow_id),
226 std::stringstream ss; 226 name_(name),
227 ss << name << "_" << flow_id; 227 algorithm_name_(algorithm_name) {
228 name_ = ss.str(); 228 // Only used when compiling with BWE test logging enabled.
229 } 229 RTC_UNUSED(flow_id_);
230 }
230 231
231 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener, 232 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
232 const FlowIds& flow_ids, 233 const FlowIds& flow_ids,
233 const char* name, 234 const char* name,
234 const std::string& plot_name) 235 const std::string& algorithm_name)
235 : PacketProcessor(listener, flow_ids, kRegular), 236 : PacketProcessor(listener, flow_ids, kRegular),
236 packets_per_second_stats_(), 237 packets_per_second_stats_(),
237 kbps_stats_(), 238 kbps_stats_(),
238 start_plotting_time_ms_(0), 239 start_plotting_time_ms_(0),
239 plot_name_(plot_name) { 240 flow_id_(0),
241 name_(name),
242 algorithm_name_(algorithm_name) {
243 // TODO(terelius): Appending the flow IDs to the algorithm name is a hack to
244 // keep the current plot functionality without having to print the full
245 // context for each PLOT line. It is unclear whether multiple flow IDs are
246 // needed at all in the long term.
240 std::stringstream ss; 247 std::stringstream ss;
241 ss << name; 248 ss << algorithm_name_;
242 char delimiter = '_';
243 for (int flow_id : flow_ids) { 249 for (int flow_id : flow_ids) {
244 ss << delimiter << flow_id; 250 ss << ',' << flow_id;
245 delimiter = ',';
246 } 251 }
247 name_ = ss.str(); 252 algorithm_name_ = ss.str();
248 } 253 }
249 254
250 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener, 255 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
251 const FlowIds& flow_ids, 256 const FlowIds& flow_ids,
252 const char* name, 257 const char* name,
253 int64_t start_plotting_time_ms, 258 int64_t start_plotting_time_ms,
254 const std::string& plot_name) 259 const std::string& algorithm_name)
255 : RateCounterFilter(listener, flow_ids, name, plot_name) { 260 : RateCounterFilter(listener, flow_ids, name, algorithm_name) {
256 start_plotting_time_ms_ = start_plotting_time_ms; 261 start_plotting_time_ms_ = start_plotting_time_ms;
257 } 262 }
258 263
259 RateCounterFilter::~RateCounterFilter() { 264 RateCounterFilter::~RateCounterFilter() {
260 LogStats(); 265 LogStats();
261 } 266 }
262 267
263 268
264 void RateCounterFilter::LogStats() { 269 void RateCounterFilter::LogStats() {
265 BWE_TEST_LOGGING_CONTEXT("RateCounterFilter"); 270 BWE_TEST_LOGGING_CONTEXT("RateCounterFilter");
266 packets_per_second_stats_.Log("pps"); 271 packets_per_second_stats_.Log("pps");
267 kbps_stats_.Log("kbps"); 272 kbps_stats_.Log("kbps");
268 } 273 }
269 274
270 Stats<double> RateCounterFilter::GetBitrateStats() const { 275 Stats<double> RateCounterFilter::GetBitrateStats() const {
271 return kbps_stats_; 276 return kbps_stats_;
272 } 277 }
273 278
274 void RateCounterFilter::Plot(int64_t timestamp_ms) { 279 void RateCounterFilter::Plot(int64_t timestamp_ms) {
275 uint32_t plot_kbps = 0; 280 uint32_t plot_kbps = 0;
276 if (timestamp_ms >= start_plotting_time_ms_) { 281 if (timestamp_ms >= start_plotting_time_ms_) {
277 plot_kbps = rate_counter_.bits_per_second() / 1000.0; 282 plot_kbps = rate_counter_.bits_per_second() / 1000.0;
278 } 283 }
279 BWE_TEST_LOGGING_CONTEXT(name_.c_str()); 284 BWE_TEST_LOGGING_CONTEXT(name_.c_str());
280 if (plot_name_.empty()) { 285 if (algorithm_name_.empty()) {
281 BWE_TEST_LOGGING_PLOT(0, "Throughput_kbps#1", timestamp_ms, plot_kbps); 286 BWE_TEST_LOGGING_PLOT_WITH_SSRC(0, "Throughput_kbps#1", timestamp_ms,
287 plot_kbps, flow_id_);
282 } else { 288 } else {
283 BWE_TEST_LOGGING_PLOT_WITH_NAME(0, "Throughput_kbps#1", timestamp_ms, 289 BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC(0, "Throughput_kbps#1",
284 plot_kbps, plot_name_); 290 timestamp_ms, plot_kbps, flow_id_,
291 algorithm_name_);
285 } 292 }
286 293
287 RTC_UNUSED(plot_kbps); 294 RTC_UNUSED(plot_kbps);
288 } 295 }
289 296
290 void RateCounterFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) { 297 void RateCounterFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) {
291 assert(in_out); 298 assert(in_out);
292 for (const Packet* packet : *in_out) { 299 for (const Packet* packet : *in_out) {
293 rate_counter_.UpdateRates(packet->send_time_us(), 300 rate_counter_.UpdateRates(packet->send_time_us(),
294 static_cast<int>(packet->payload_size())); 301 static_cast<int>(packet->payload_size()));
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, 812 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size,
806 uint32_t remaining_payload) { 813 uint32_t remaining_payload) {
807 uint32_t fragments = 814 uint32_t fragments =
808 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; 815 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes;
809 uint32_t avg_size = (frame_size + fragments - 1) / fragments; 816 uint32_t avg_size = (frame_size + fragments - 1) / fragments;
810 return std::min(avg_size, remaining_payload); 817 return std::min(avg_size, remaining_payload);
811 } 818 }
812 } // namespace bwe 819 } // namespace bwe
813 } // namespace testing 820 } // namespace testing
814 } // namespace webrtc 821 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698