Chromium Code Reviews| 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 |
| 33 result.value is None): | |
|
marja
2013/06/06 13:03:32
-> "or not result.value"
Sami
2013/06/06 13:10:03
See above; 0 is a valid result.value but None isn'
marja
2013/06/06 13:31:44
Ah, alright :)
| |
| 33 continue | 34 continue |
| 34 name = '%s (%s)' % (result.name, result.unit) | 35 name = '%s (%s)' % (result.name, result.unit) |
| 35 if isinstance(result.value, list): | 36 if isinstance(result.value, list): |
| 36 value = result.value | 37 value = result.value |
| 37 else: | 38 else: |
| 38 value = [result.value] | 39 value = [result.value] |
| 39 merged_results[name] += value | 40 merged_results[name] += value |
| 40 for name, values in merged_results.iteritems(): | 41 for name, values in merged_results.iteritems(): |
| 41 merged_results[name] = sum(values) / float(len(values)) | 42 merged_results[name] = sum(values) / float(len(values)) |
| 42 return merged_results | 43 return merged_results |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 _PrintResults(results) | 123 _PrintResults(results) |
| 123 row_count += 1 | 124 row_count += 1 |
| 124 except KeyboardInterrupt: | 125 except KeyboardInterrupt: |
| 125 sys.exit(0) | 126 sys.exit(0) |
| 126 finally: | 127 finally: |
| 127 collector.Stop() | 128 collector.Stop() |
| 128 | 129 |
| 129 | 130 |
| 130 if __name__ == '__main__': | 131 if __name__ == '__main__': |
| 131 main(sys.argv) | 132 main(sys.argv) |
| OLD | NEW |