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 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 'max_frame_delay (vsyncs)': '%d', | 22 'max_frame_delay (vsyncs)': '%d', |
23 'avg_surface_fps (fps)': '%.2f', | 23 'avg_surface_fps (fps)': '%.2f', |
24 'frame_lengths (vsyncs)': '%.3f', | 24 'frame_lengths (vsyncs)': '%.3f', |
25 'refresh_period (seconds)': '%.6f', | 25 'refresh_period (seconds)': '%.6f', |
26 } | 26 } |
27 | 27 |
28 | 28 |
29 def _MergeResults(results, fields): | 29 def _MergeResults(results, fields): |
30 merged_results = collections.defaultdict(list) | 30 merged_results = collections.defaultdict(list) |
31 for result in results: | 31 for result in results: |
32 if fields != ['all'] and not result.name in fields: | 32 if (fields != ['all'] and not result.name in fields) or not result.value: |
Sami
2013/06/05 15:27:25
The last part should be "or result.value is None"
bulach
2013/06/05 15:38:01
Done.
| |
33 continue | 33 continue |
34 name = '%s (%s)' % (result.name, result.unit) | 34 name = '%s (%s)' % (result.name, result.unit) |
35 if isinstance(result.value, list): | 35 if isinstance(result.value, list): |
36 value = result.value | 36 value = result.value |
37 else: | 37 else: |
38 value = [result.value] | 38 value = [result.value] |
39 merged_results[name] += value | 39 merged_results[name] += value |
40 for name, values in merged_results.iteritems(): | 40 for name, values in merged_results.iteritems(): |
41 merged_results[name] = sum(values) / float(len(values)) | 41 merged_results[name] = sum(values) / float(len(values)) |
42 return merged_results | 42 return merged_results |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 _PrintResults(results) | 122 _PrintResults(results) |
123 row_count += 1 | 123 row_count += 1 |
124 except KeyboardInterrupt: | 124 except KeyboardInterrupt: |
125 sys.exit(0) | 125 sys.exit(0) |
126 finally: | 126 finally: |
127 collector.Stop() | 127 collector.Stop() |
128 | 128 |
129 | 129 |
130 if __name__ == '__main__': | 130 if __name__ == '__main__': |
131 main(sys.argv) | 131 main(sys.argv) |
OLD | NEW |