OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Command line tool for continuously printing Android graphics surface | 7 """Command line tool for continuously printing Android graphics surface |
8 statistics on the console. | 8 statistics on the console. |
9 """ | 9 """ |
10 | 10 |
11 import collections | 11 import collections |
12 import optparse | 12 import optparse |
13 import sys | 13 import sys |
14 import time | 14 import time |
15 | 15 |
16 from pylib import android_commands, surface_stats_collector | 16 from pylib import android_commands, surface_stats_collector |
17 from pylib.utils import run_tests_helper | 17 from pylib.utils import run_tests_helper |
18 | 18 |
19 | 19 |
20 _FIELD_FORMAT = { | 20 _FIELD_FORMAT = { |
21 'jank_count (janks)': '%d', | 21 'jank_count (janks)': '%d', |
22 'max_frame_delay (vsyncs)': '%d', | 22 'max_frame_delay (vsyncs)': '%d', |
23 'avg_surface_fps (fps)': '%.2f', | |
24 'frame_lengths (vsyncs)': '%.3f', | 23 'frame_lengths (vsyncs)': '%.3f', |
25 'refresh_period (seconds)': '%.6f', | 24 'refresh_period (seconds)': '%.6f', |
25 'avg_surface_fps (fps)': '%.2f', | |
26 'avg_surface_fps_0.9 (fps)': '%.2f', | |
Sami
2013/07/03 15:11:50
I think we should just hide the windowed results i
| |
27 'avg_surface_fps_0.5 (fps)': '%.2f', | |
26 } | 28 } |
27 | 29 |
28 | 30 |
29 def _MergeResults(results, fields): | 31 def _MergeResults(results, fields): |
30 merged_results = collections.defaultdict(list) | 32 merged_results = collections.defaultdict(list) |
31 for result in results: | 33 for result in results: |
32 if ((fields != ['all'] and not result.name in fields) or | 34 if ((fields != ['all'] and not result.name in fields) or |
33 result.value is None): | 35 result.value is None): |
34 continue | 36 continue |
35 name = '%s (%s)' % (result.name, result.unit) | 37 name = '%s (%s)' % (result.name, result.unit) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 '--verbose', | 79 '--verbose', |
78 dest='verbose_count', | 80 dest='verbose_count', |
79 default=0, | 81 default=0, |
80 action='count', | 82 action='count', |
81 help='Verbose level (multiple times for more)') | 83 help='Verbose level (multiple times for more)') |
82 parser.add_option('--device', | 84 parser.add_option('--device', |
83 help='Serial number of device we should use.') | 85 help='Serial number of device we should use.') |
84 parser.add_option('-f', | 86 parser.add_option('-f', |
85 '--fields', | 87 '--fields', |
86 dest='fields', | 88 dest='fields', |
87 default='jank_count,max_frame_delay,avg_surface_fps,' | 89 default='jank_count,max_frame_delay,' |
88 'frame_lengths', | 90 'frame_lengths,avg_surface_fps,avg_surface_fps_0_9,' |
91 'avg_surface_fps_0_5,', | |
89 help='Comma separated list of fields to display or "all".') | 92 help='Comma separated list of fields to display or "all".') |
90 parser.add_option('-d', | 93 parser.add_option('-d', |
91 '--delay', | 94 '--delay', |
92 dest='delay', | 95 dest='delay', |
93 default=1, | 96 default=1, |
94 type='float', | 97 type='float', |
95 help='Time in seconds to sleep between updates.') | 98 help='Time in seconds to sleep between updates.') |
96 | 99 |
97 options, args = parser.parse_args(argv) | 100 options, args = parser.parse_args(argv) |
98 run_tests_helper.SetLogLevel(options.verbose_count) | 101 run_tests_helper.SetLogLevel(options.verbose_count) |
(...skipping 24 matching lines...) Expand all Loading... | |
123 _PrintResults(results) | 126 _PrintResults(results) |
124 row_count += 1 | 127 row_count += 1 |
125 except KeyboardInterrupt: | 128 except KeyboardInterrupt: |
126 sys.exit(0) | 129 sys.exit(0) |
127 finally: | 130 finally: |
128 collector.Stop() | 131 collector.Stop() |
129 | 132 |
130 | 133 |
131 if __name__ == '__main__': | 134 if __name__ == '__main__': |
132 main(sys.argv) | 135 main(sys.argv) |
OLD | NEW |