OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
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 """Generate graphs for data generated by loopback tests. | 10 """Generate graphs for data generated by loopback tests. |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 import argparse | 28 import argparse |
29 from collections import defaultdict | 29 from collections import defaultdict |
30 import itertools | 30 import itertools |
31 import sys | 31 import sys |
32 import matplotlib.pyplot as plt | 32 import matplotlib.pyplot as plt |
33 import numpy | 33 import numpy |
34 | 34 |
35 # Fields | 35 # Fields |
36 DROPPED = 0 | 36 DROPPED = 0 |
37 INPUT_TIME = 1 # ms | 37 INPUT_TIME = 1 # ms (timestamp) |
38 SEND_TIME = 2 # ms | 38 SEND_TIME = 2 # ms (timestamp) |
39 RECV_TIME = 3 # ms | 39 RECV_TIME = 3 # ms (timestamp) |
40 ENCODED_FRAME_SIZE = 4 # bytes | 40 RENDER_TIME = 4 # ms (timestamp) |
41 PSNR = 5 | 41 ENCODED_FRAME_SIZE = 5 # bytes |
42 SSIM = 6 | 42 PSNR = 6 |
43 RENDER_TIME = 7 # ms | 43 SSIM = 7 |
| 44 ENCODE_TIME = 8 # ms (time interval) |
44 | 45 |
45 TOTAL_RAW_FIELDS = 8 | 46 TOTAL_RAW_FIELDS = 9 |
46 | 47 |
47 SENDER_TIME = TOTAL_RAW_FIELDS + 0 | 48 SENDER_TIME = TOTAL_RAW_FIELDS + 0 |
48 RECEIVER_TIME = TOTAL_RAW_FIELDS + 1 | 49 RECEIVER_TIME = TOTAL_RAW_FIELDS + 1 |
49 END_TO_END = TOTAL_RAW_FIELDS + 2 | 50 END_TO_END = TOTAL_RAW_FIELDS + 2 |
50 RENDERED_DELTA = TOTAL_RAW_FIELDS + 3 | 51 RENDERED_DELTA = TOTAL_RAW_FIELDS + 3 |
51 | 52 |
52 FIELD_MASK = 255 | 53 FIELD_MASK = 255 |
53 | 54 |
54 # Options | 55 # Options |
55 HIDE_DROPPED = 256 | 56 HIDE_DROPPED = 256 |
56 RIGHT_Y_AXIS = 512 | 57 RIGHT_Y_AXIS = 512 |
57 | 58 |
58 # internal field id, field name, title | 59 # internal field id, field name, title |
59 _fields = [ | 60 _fields = [ |
60 # Raw | 61 # Raw |
61 (DROPPED, "dropped", "dropped"), | 62 (DROPPED, "dropped", "dropped"), |
62 (INPUT_TIME, "input_time_ms", "input time"), | 63 (INPUT_TIME, "input_time_ms", "input time"), |
63 (SEND_TIME, "send_time_ms", "send time"), | 64 (SEND_TIME, "send_time_ms", "send time"), |
64 (RECV_TIME, "recv_time_ms", "recv time"), | 65 (RECV_TIME, "recv_time_ms", "recv time"), |
65 (ENCODED_FRAME_SIZE, "encoded_frame_size", "encoded frame size"), | 66 (ENCODED_FRAME_SIZE, "encoded_frame_size", "encoded frame size"), |
66 (PSNR, "psnr", "PSNR"), | 67 (PSNR, "psnr", "PSNR"), |
67 (SSIM, "ssim", "SSIM"), | 68 (SSIM, "ssim", "SSIM"), |
68 (RENDER_TIME, "render_time_ms", "render time"), | 69 (RENDER_TIME, "render_time_ms", "render time"), |
| 70 (ENCODE_TIME, "encode_time_ms", "encode time"), |
69 # Auto-generated | 71 # Auto-generated |
70 (SENDER_TIME, "sender_time", "sender time"), | 72 (SENDER_TIME, "sender_time", "sender time"), |
71 (RECEIVER_TIME, "receiver_time", "receiver time"), | 73 (RECEIVER_TIME, "receiver_time", "receiver time"), |
72 (END_TO_END, "end_to_end", "end to end"), | 74 (END_TO_END, "end_to_end", "end to end"), |
73 (RENDERED_DELTA, "rendered_delta", "rendered delta"), | 75 (RENDERED_DELTA, "rendered_delta", "rendered delta"), |
74 ] | 76 ] |
75 | 77 |
76 name_to_id = {field[1]: field[0] for field in _fields} | 78 name_to_id = {field[1]: field[0] for field in _fields} |
77 id_to_title = {field[0]: field[2] for field in _fields} | 79 id_to_title = {field[0]: field[2] for field in _fields} |
78 | 80 |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 config.plot(ax) | 405 config.plot(ax) |
404 if config.output_filename: | 406 if config.output_filename: |
405 print "Saving to", config.output_filename | 407 print "Saving to", config.output_filename |
406 fig.savefig(config.output_filename) | 408 fig.savefig(config.output_filename) |
407 plt.close(fig) | 409 plt.close(fig) |
408 | 410 |
409 plt.show() | 411 plt.show() |
410 | 412 |
411 if __name__ == "__main__": | 413 if __name__ == "__main__": |
412 show_or_save_plots(plot_configs_from_args(sys.argv[1:])) | 414 show_or_save_plots(plot_configs_from_args(sys.argv[1:])) |
OLD | NEW |