OLD | NEW |
1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2017 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 """Plots statistics from WebRTC integration test logs. | 9 """Plots statistics from WebRTC integration test logs. |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 # Metrics to plot, tuple: (name to parse in file, label to use when plotting). | 24 # Metrics to plot, tuple: (name to parse in file, label to use when plotting). |
25 BITRATE = ('Target Bitrate', 'bitrate (kbps)') | 25 BITRATE = ('Target Bitrate', 'bitrate (kbps)') |
26 WIDTH = ('Width', 'width') | 26 WIDTH = ('Width', 'width') |
27 HEIGHT = ('Height', 'height') | 27 HEIGHT = ('Height', 'height') |
28 FILENAME = ('Filename', 'clip') | 28 FILENAME = ('Filename', 'clip') |
29 CODEC_TYPE = ('Codec type', 'Codec') | 29 CODEC_TYPE = ('Codec type', 'Codec') |
30 ENCODER_IMPLEMENTATION_NAME = ('Encoder implementation name', 'enc name') | 30 ENCODER_IMPLEMENTATION_NAME = ('Encoder implementation name', 'enc name') |
31 DECODER_IMPLEMENTATION_NAME = ('Decoder implementation name', 'dec name') | 31 DECODER_IMPLEMENTATION_NAME = ('Decoder implementation name', 'dec name') |
32 NUM_FRAMES = ('Total # of frames', 'num frames') | 32 NUM_FRAMES = ('Total # of frames', 'num frames') |
33 CORES = ('#CPU cores used', 'cores') | 33 CORES = ('#CPU cores used', 'CPU cores used') |
34 DENOISING = ('Denoising', 'denoising') | 34 DENOISING = ('Denoising', 'denoising') |
35 RESILIENCE = ('Resilience', 'resilience') | 35 RESILIENCE = ('Resilience', 'resilience') |
36 ERROR_CONCEALMENT = ('Error concealment', 'error concealment') | 36 ERROR_CONCEALMENT = ('Error concealment', 'error concealment') |
37 PSNR = ('PSNR avg', 'PSNR (dB)') | 37 PSNR = ('PSNR avg', 'PSNR (dB)') |
38 SSIM = ('SSIM avg', 'SSIM') | 38 SSIM = ('SSIM avg', 'SSIM') |
39 ENC_BITRATE = ('Encoding bitrate', 'encoded bitrate (kbps)') | 39 ENC_BITRATE = ('Encoding bitrate', 'encoded bitrate (kbps)') |
40 FRAMERATE = ('Frame rate', 'fps') | 40 FRAMERATE = ('Frame rate', 'fps') |
41 NUM_DROPPED_FRAMES = ('Number of dropped frames', 'num dropped frames') | 41 NUM_DROPPED_FRAMES = ('Number of dropped frames', 'num dropped frames') |
42 NUM_FRAMES_TO_TARGET = ('Number of frames to approach target rate', | 42 NUM_FRAMES_TO_TARGET = ('Number of frames to approach target rate', |
43 'frames to reach target rate') | 43 'frames to reach target rate') |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 f.close() | 139 f.close() |
140 return settings | 140 return settings |
141 | 141 |
142 | 142 |
143 def ParseMetrics(filename, setting1, setting2): | 143 def ParseMetrics(filename, setting1, setting2): |
144 """Parses metrics from file. | 144 """Parses metrics from file. |
145 | 145 |
146 Args: | 146 Args: |
147 filename: The name of the file. | 147 filename: The name of the file. |
148 setting1: First setting for sorting metrics (e.g. width). | 148 setting1: First setting for sorting metrics (e.g. width). |
149 setting2: Second setting for sorting metrics (e.g. cores). | 149 setting2: Second setting for sorting metrics (e.g. CPU cores used). |
150 | 150 |
151 Returns: | 151 Returns: |
152 A dictionary holding parsed metrics. | 152 A dictionary holding parsed metrics. |
153 | 153 |
154 For example: | 154 For example: |
155 metrics[key1][key2][measurement] | 155 metrics[key1][key2][measurement] |
156 | 156 |
157 metrics = { | 157 metrics = { |
158 "width: 352": { | 158 "width: 352": { |
159 "cores: 1.0": { | 159 "CPU cores used: 1.0": { |
160 "encode time (us)": [0.718005, 0.806925, 0.909726, 0.931835, 0.953642], | 160 "encode time (us)": [0.718005, 0.806925, 0.909726, 0.931835, 0.953642], |
161 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], | 161 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], |
162 "bitrate (kbps)": [50, 100, 300, 500, 1000] | 162 "bitrate (kbps)": [50, 100, 300, 500, 1000] |
163 }, | 163 }, |
164 "cores: 2.0": { | 164 "CPU cores used: 2.0": { |
165 "encode time (us)": [0.718005, 0.806925, 0.909726, 0.931835, 0.953642], | 165 "encode time (us)": [0.718005, 0.806925, 0.909726, 0.931835, 0.953642], |
166 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], | 166 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], |
167 "bitrate (kbps)": [50, 100, 300, 500, 1000] | 167 "bitrate (kbps)": [50, 100, 300, 500, 1000] |
168 }, | 168 }, |
169 }, | 169 }, |
170 "width: 176": { | 170 "width: 176": { |
171 "cores: 1.0": { | 171 "CPU cores used: 1.0": { |
172 "encode time (us)": [0.857897, 0.91608, 0.959173, 0.971116, 0.980961], | 172 "encode time (us)": [0.857897, 0.91608, 0.959173, 0.971116, 0.980961], |
173 "PSNR (dB)": [30.243646, 33.375592, 37.574387, 39.42184, 41.437897], | 173 "PSNR (dB)": [30.243646, 33.375592, 37.574387, 39.42184, 41.437897], |
174 "bitrate (kbps)": [50, 100, 300, 500, 1000] | 174 "bitrate (kbps)": [50, 100, 300, 500, 1000] |
175 }, | 175 }, |
176 } | 176 } |
177 } """ | 177 } """ |
178 | 178 |
179 metrics = {} | 179 metrics = {} |
180 | 180 |
181 # Parse events. | 181 # Parse events. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return True, value | 266 return True, value |
267 | 267 |
268 | 268 |
269 def Plot(y_metric, x_metric, metrics): | 269 def Plot(y_metric, x_metric, metrics): |
270 """Plots y_metric vs x_metric per key in metrics. | 270 """Plots y_metric vs x_metric per key in metrics. |
271 | 271 |
272 For example: | 272 For example: |
273 y_metric = 'PSNR (dB)' | 273 y_metric = 'PSNR (dB)' |
274 x_metric = 'bitrate (kbps)' | 274 x_metric = 'bitrate (kbps)' |
275 metrics = { | 275 metrics = { |
276 "cores: 1.0": { | 276 "CPU cores used: 1.0": { |
277 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], | 277 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], |
278 "bitrate (kbps)": [50, 100, 300, 500, 1000] | 278 "bitrate (kbps)": [50, 100, 300, 500, 1000] |
279 }, | 279 }, |
280 "cores: 2.0": { | 280 "CPU cores used: 2.0": { |
281 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], | 281 "PSNR (dB)": [25.546029, 29.465518, 34.723535, 36.428493, 38.686551], |
282 "bitrate (kbps)": [50, 100, 300, 500, 1000] | 282 "bitrate (kbps)": [50, 100, 300, 500, 1000] |
283 }, | 283 }, |
284 } | 284 } |
285 """ | 285 """ |
286 for key in metrics: | 286 for key in metrics: |
287 data = metrics[key] | 287 data = metrics[key] |
288 if y_metric not in data: | 288 if y_metric not in data: |
289 print "Failed to find metric: %s" % y_metric | 289 print "Failed to find metric: %s" % y_metric |
290 continue | 290 continue |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 plt.xlabel(x_metric, fontsize='small') | 332 plt.xlabel(x_metric, fontsize='small') |
333 plt.subplots_adjust(left=0.04, right=0.98, bottom=0.04, top=0.96, hspace=0.1) | 333 plt.subplots_adjust(left=0.04, right=0.98, bottom=0.04, top=0.96, hspace=0.1) |
334 | 334 |
335 | 335 |
336 def GetTitle(filename): | 336 def GetTitle(filename): |
337 title = '' | 337 title = '' |
338 codec_types = ParseSetting(filename, CODEC_TYPE[1]) | 338 codec_types = ParseSetting(filename, CODEC_TYPE[1]) |
339 for i in range(0, len(codec_types)): | 339 for i in range(0, len(codec_types)): |
340 title += codec_types[i] + ', ' | 340 title += codec_types[i] + ', ' |
341 | 341 |
| 342 cores = ParseSetting(filename, CORES[1]) |
| 343 for i in range(0, len(cores)): |
| 344 title += cores[i].split('.')[0] + ', ' |
| 345 |
342 framerate = ParseSetting(filename, FRAMERATE[1]) | 346 framerate = ParseSetting(filename, FRAMERATE[1]) |
343 for i in range(0, len(framerate)): | 347 for i in range(0, len(framerate)): |
344 title += framerate[i].split('.')[0] + ', ' | 348 title += framerate[i].split('.')[0] + ', ' |
345 | 349 |
346 enc_names = ParseSetting(filename, ENCODER_IMPLEMENTATION_NAME[1]) | 350 enc_names = ParseSetting(filename, ENCODER_IMPLEMENTATION_NAME[1]) |
347 for i in range(0, len(enc_names)): | 351 for i in range(0, len(enc_names)): |
348 title += enc_names[i] + ', ' | 352 title += enc_names[i] + ', ' |
349 | 353 |
350 dec_names = ParseSetting(filename, DECODER_IMPLEMENTATION_NAME[1]) | 354 dec_names = ParseSetting(filename, DECODER_IMPLEMENTATION_NAME[1]) |
351 for i in range(0, len(dec_names)): | 355 for i in range(0, len(dec_names)): |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 figsize[1] *= FIG_SIZE_SCALE_FACTOR_Y | 428 figsize[1] *= FIG_SIZE_SCALE_FACTOR_Y |
425 plt.rcParams["figure.figsize"] = figsize | 429 plt.rcParams["figure.figsize"] = figsize |
426 | 430 |
427 PlotFigure(sub_keys, y_metrics, x_metric, metrics, GetTitle(filename)) | 431 PlotFigure(sub_keys, y_metrics, x_metric, metrics, GetTitle(filename)) |
428 | 432 |
429 plt.show() | 433 plt.show() |
430 | 434 |
431 | 435 |
432 if __name__ == '__main__': | 436 if __name__ == '__main__': |
433 main() | 437 main() |
OLD | NEW |