 Chromium Code Reviews
 Chromium Code Reviews Issue 2316573003:
  Python event log analyzer tool: fix of indexing issue.  (Closed)
    
  
    Issue 2316573003:
  Python event log analyzer tool: fix of indexing issue.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 
| 2 # | 2 # | 
| 3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license | 
| 4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source | 
| 5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found | 
| 6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may | 
| 7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. | 
| 8 | 8 | 
| 9 """Displays statistics and plots graphs from RTC protobuf dump.""" | 9 """Displays statistics and plots graphs from RTC protobuf dump.""" | 
| 10 | 10 | 
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 | 264 | 
| 265 def calculate_delay(start, stop, step, points): | 265 def calculate_delay(start, stop, step, points): | 
| 266 """Quantizes the time coordinates for the delay. | 266 """Quantizes the time coordinates for the delay. | 
| 267 | 267 | 
| 268 Quantizes points by rounding the timestamps downwards to the nearest | 268 Quantizes points by rounding the timestamps downwards to the nearest | 
| 269 point in the time sequence start, start+step, start+2*step... Takes | 269 point in the time sequence start, start+step, start+2*step... Takes | 
| 270 the average of the delays of points rounded to the same. Returns | 270 the average of the delays of points rounded to the same. Returns | 
| 271 masked array, in which time points with no value are masked. | 271 masked array, in which time points with no value are masked. | 
| 272 | 272 | 
| 273 """ | 273 """ | 
| 274 grouped_delays = [[] for _ in numpy.arange(start, stop, step)] | 274 grouped_delays = [[] for _ in numpy.arange(start, stop + step, step)] | 
| 
aleloi
2016/09/06 11:08:11
Silly indexing bug wasn't noticed because of insuf
 | |
| 275 rounded_value_index = lambda x: int((x - start) / step) | 275 rounded_value_index = lambda x: int((x - start) / step) | 
| 276 for point in points: | 276 for point in points: | 
| 277 grouped_delays[rounded_value_index(point.real_send_time_ms) | 277 grouped_delays[rounded_value_index(point.real_send_time_ms) | 
| 278 ].append(point.absdelay) | 278 ].append(point.absdelay) | 
| 279 regularized_delays = [numpy.average(arr) if arr else -1 for arr in | 279 regularized_delays = [numpy.average(arr) if arr else -1 for arr in | 
| 280 grouped_delays] | 280 grouped_delays] | 
| 281 return numpy.ma.masked_values(regularized_delays, -1) | 281 return numpy.ma.masked_values(regularized_delays, -1) | 
| 282 | 282 | 
| 283 | 283 | 
| 284 def main(): | 284 def main(): | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 print("Statistics:") | 322 print("Statistics:") | 
| 323 rtp_stats.print_sequence_number_statistics() | 323 rtp_stats.print_sequence_number_statistics() | 
| 324 rtp_stats.estimate_frequency(options.query_sample_rate) | 324 rtp_stats.estimate_frequency(options.query_sample_rate) | 
| 325 rtp_stats.print_duration_statistics() | 325 rtp_stats.print_duration_statistics() | 
| 326 rtp_stats.remove_reordered() | 326 rtp_stats.remove_reordered() | 
| 327 rtp_stats.compute_bandwidth() | 327 rtp_stats.compute_bandwidth() | 
| 328 rtp_stats.plot_statistics() | 328 rtp_stats.plot_statistics() | 
| 329 | 329 | 
| 330 if __name__ == "__main__": | 330 if __name__ == "__main__": | 
| 331 main() | 331 main() | 
| OLD | NEW |