OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import Queue | 5 import Queue |
6 import datetime | 6 import datetime |
7 import logging | 7 import logging |
8 import re | 8 import re |
9 import threading | 9 import threading |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 'vsyncs'), | 112 'vsyncs'), |
113 SurfaceStatsCollector.Result( | 113 SurfaceStatsCollector.Result( |
114 'frame_lengths' + result_suffix, normalized_frame_lengths, | 114 'frame_lengths' + result_suffix, normalized_frame_lengths, |
115 'vsyncs'), | 115 'vsyncs'), |
116 ] | 116 ] |
117 | 117 |
118 @staticmethod | 118 @staticmethod |
119 def _CalculateBuckets(refresh_period, timestamps): | 119 def _CalculateBuckets(refresh_period, timestamps): |
120 results = [] | 120 results = [] |
121 for pct in [0.99, 0.5]: | 121 for pct in [0.99, 0.5]: |
122 sliced = timestamps[int(-pct * len(timestamps)) + 3 : ] | 122 sliced = timestamps[min(int(-pct * len(timestamps)), -3) : ] |
123 results += SurfaceStatsCollector._CalculateResults( | 123 results += SurfaceStatsCollector._CalculateResults( |
124 refresh_period, sliced, '_' + str(int(pct * 100))) | 124 refresh_period, sliced, '_' + str(int(pct * 100))) |
125 return results | 125 return results |
126 | 126 |
127 def _StorePerfResults(self): | 127 def _StorePerfResults(self): |
128 if self._use_legacy_method: | 128 if self._use_legacy_method: |
129 surface_after = self._GetSurfaceStatsLegacy() | 129 surface_after = self._GetSurfaceStatsLegacy() |
130 td = surface_after['timestamp'] - self._surface_before['timestamp'] | 130 td = surface_after['timestamp'] - self._surface_before['timestamp'] |
131 seconds = td.seconds + td.microseconds / 1e6 | 131 seconds = td.seconds + td.microseconds / 1e6 |
132 frame_count = (surface_after['page_flip_count'] - | 132 frame_count = (surface_after['page_flip_count'] - |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 try: | 288 try: |
289 cur_surface = int(match.group(1), 16) | 289 cur_surface = int(match.group(1), 16) |
290 except Exception: | 290 except Exception: |
291 logging.error('Failed to parse current surface from ' + match.group(1)) | 291 logging.error('Failed to parse current surface from ' + match.group(1)) |
292 else: | 292 else: |
293 logging.warning('Failed to call SurfaceFlinger surface ' + results[0]) | 293 logging.warning('Failed to call SurfaceFlinger surface ' + results[0]) |
294 return { | 294 return { |
295 'page_flip_count': cur_surface, | 295 'page_flip_count': cur_surface, |
296 'timestamp': datetime.datetime.now(), | 296 'timestamp': datetime.datetime.now(), |
297 } | 297 } |
OLD | NEW |