Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: build/android/pylib/surface_stats_collector.py

Issue 16438003: Android / Telemetry: make surface_stats_collector more robust. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: is None Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/surface_stats.py » ('j') | build/android/surface_stats.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 def Stop(self): 58 def Stop(self):
59 self._StorePerfResults() 59 self._StorePerfResults()
60 if self._collector_thread: 60 if self._collector_thread:
61 self._stop_event.set() 61 self._stop_event.set()
62 self._collector_thread.join() 62 self._collector_thread.join()
63 self._collector_thread = None 63 self._collector_thread = None
64 64
65 def SampleResults(self): 65 def SampleResults(self):
66 self._StorePerfResults() 66 self._StorePerfResults()
67 results = self._results 67 results = self.GetResults()
68 self._results = [] 68 self._results = []
69 return results 69 return results
70 70
71 def GetResults(self): 71 def GetResults(self):
72 return self._results 72 return self._results or self._GetEmptyResults()
73
74 def _GetEmptyResults(self):
75 return [
76 SurfaceStatsCollector.Result('refresh_period', None, 'seconds'),
77 SurfaceStatsCollector.Result('jank_count', None, 'janks'),
78 SurfaceStatsCollector.Result('max_frame_delay', None, 'vsyncs'),
79 SurfaceStatsCollector.Result('frame_lengths', None, 'vsyncs'),
80 SurfaceStatsCollector.Result('avg_surface_fps', None, 'fps')
81 ]
73 82
74 @staticmethod 83 @staticmethod
75 def _GetNormalizedDeltas(data, refresh_period): 84 def _GetNormalizedDeltas(data, refresh_period):
76 deltas = [t2 - t1 for t1, t2 in zip(data, data[1:])] 85 deltas = [t2 - t1 for t1, t2 in zip(data, data[1:])]
77 return (deltas, [delta / refresh_period for delta in deltas]) 86 return (deltas, [delta / refresh_period for delta in deltas])
78 87
79 def _StorePerfResults(self): 88 def _StorePerfResults(self):
80 if self._use_legacy_method: 89 if self._use_legacy_method:
81 surface_after = self._GetSurfaceStatsLegacy() 90 surface_after = self._GetSurfaceStatsLegacy()
82 td = surface_after['timestamp'] - self._surface_before['timestamp'] 91 td = surface_after['timestamp'] - self._surface_before['timestamp']
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 try: 264 try:
256 cur_surface = int(match.group(1), 16) 265 cur_surface = int(match.group(1), 16)
257 except Exception: 266 except Exception:
258 logging.error('Failed to parse current surface from ' + match.group(1)) 267 logging.error('Failed to parse current surface from ' + match.group(1))
259 else: 268 else:
260 logging.warning('Failed to call SurfaceFlinger surface ' + results[0]) 269 logging.warning('Failed to call SurfaceFlinger surface ' + results[0])
261 return { 270 return {
262 'page_flip_count': cur_surface, 271 'page_flip_count': cur_surface,
263 'timestamp': datetime.datetime.now(), 272 'timestamp': datetime.datetime.now(),
264 } 273 }
OLDNEW
« no previous file with comments | « no previous file | build/android/surface_stats.py » ('j') | build/android/surface_stats.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698