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

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

Issue 18341006: SurfaceStats / Telemetry: calculate FPS in different frame buckets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 7 years, 5 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 SurfaceStatsCollector.Result('max_frame_delay', None, 'vsyncs'), 78 SurfaceStatsCollector.Result('max_frame_delay', None, 'vsyncs'),
79 SurfaceStatsCollector.Result('frame_lengths', None, 'vsyncs'), 79 SurfaceStatsCollector.Result('frame_lengths', None, 'vsyncs'),
80 SurfaceStatsCollector.Result('avg_surface_fps', None, 'fps') 80 SurfaceStatsCollector.Result('avg_surface_fps', None, 'fps')
81 ] 81 ]
82 82
83 @staticmethod 83 @staticmethod
84 def _GetNormalizedDeltas(data, refresh_period): 84 def _GetNormalizedDeltas(data, refresh_period):
85 deltas = [t2 - t1 for t1, t2 in zip(data, data[1:])] 85 deltas = [t2 - t1 for t1, t2 in zip(data, data[1:])]
86 return (deltas, [delta / refresh_period for delta in deltas]) 86 return (deltas, [delta / refresh_period for delta in deltas])
87 87
88 def _CalcFpsInBuckets(self, timestamps):
89 for pct in [0.9, 0.5]:
90 sliced = timestamps[int(-pct * len(timestamps)) + 3 : ]
Sami 2013/07/03 15:11:50 Probably want to bail out here if there were too f
bulach 2013/07/03 18:09:15 when is the "legacy" method used? the non-legacy g
Sami 2013/07/03 18:21:37 Ah, good point. The legacy path is only used on pr
91 seconds = sliced[-1] - sliced[0]
92 frame_count = len(sliced)
93 self._results.append(SurfaceStatsCollector.Result(
94 'avg_surface_fps_' + str(pct).replace('.', '_'),
Sami 2013/07/03 15:11:50 int(pct * 100) would gives nicer names I think :)
bulach 2013/07/03 18:09:15 indeed! done.
95 int(round(frame_count / seconds)), 'fps'))
96
88 def _StorePerfResults(self): 97 def _StorePerfResults(self):
89 if self._use_legacy_method: 98 if self._use_legacy_method:
90 surface_after = self._GetSurfaceStatsLegacy() 99 surface_after = self._GetSurfaceStatsLegacy()
91 td = surface_after['timestamp'] - self._surface_before['timestamp'] 100 td = surface_after['timestamp'] - self._surface_before['timestamp']
92 seconds = td.seconds + td.microseconds / 1e6 101 seconds = td.seconds + td.microseconds / 1e6
93 frame_count = (surface_after['page_flip_count'] - 102 frame_count = (surface_after['page_flip_count'] -
94 self._surface_before['page_flip_count']) 103 self._surface_before['page_flip_count'])
95 else: 104 else:
96 assert self._collector_thread 105 assert self._collector_thread
97 (refresh_period, timestamps) = self._GetDataFromThread() 106 (refresh_period, timestamps) = self._GetDataFromThread()
(...skipping 17 matching lines...) Expand all
115 'refresh_period', refresh_period, 'seconds')) 124 'refresh_period', refresh_period, 'seconds'))
116 self._results.append(SurfaceStatsCollector.Result( 125 self._results.append(SurfaceStatsCollector.Result(
117 'jank_count', jank_count, 'janks')) 126 'jank_count', jank_count, 'janks'))
118 self._results.append(SurfaceStatsCollector.Result( 127 self._results.append(SurfaceStatsCollector.Result(
119 'max_frame_delay', round(max(normalized_frame_lengths)), 128 'max_frame_delay', round(max(normalized_frame_lengths)),
120 'vsyncs')) 129 'vsyncs'))
121 self._results.append(SurfaceStatsCollector.Result( 130 self._results.append(SurfaceStatsCollector.Result(
122 'frame_lengths', normalized_frame_lengths, 'vsyncs')) 131 'frame_lengths', normalized_frame_lengths, 'vsyncs'))
123 self._results.append(SurfaceStatsCollector.Result( 132 self._results.append(SurfaceStatsCollector.Result(
124 'avg_surface_fps', int(round(frame_count / seconds)), 'fps')) 133 'avg_surface_fps', int(round(frame_count / seconds)), 'fps'))
134 self._CalcFpsInBuckets(timestamps)
Sami 2013/07/03 15:11:50 If we decide to go ahead with this, let's include
bulach 2013/07/03 18:09:15 I need to understand this better though: they all
Sami 2013/07/03 18:21:37 |refresh_period| is a constant given by the displa
125 135
126 def _CollectorThread(self): 136 def _CollectorThread(self):
127 last_timestamp = 0 137 last_timestamp = 0
128 timestamps = [] 138 timestamps = []
129 retries = 0 139 retries = 0
130 140
131 while not self._stop_event.is_set(): 141 while not self._stop_event.is_set():
132 self._get_data_event.wait(1) 142 self._get_data_event.wait(1)
133 try: 143 try:
134 refresh_period, new_timestamps = self._GetSurfaceFlingerFrameData() 144 refresh_period, new_timestamps = self._GetSurfaceFlingerFrameData()
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 try: 274 try:
265 cur_surface = int(match.group(1), 16) 275 cur_surface = int(match.group(1), 16)
266 except Exception: 276 except Exception:
267 logging.error('Failed to parse current surface from ' + match.group(1)) 277 logging.error('Failed to parse current surface from ' + match.group(1))
268 else: 278 else:
269 logging.warning('Failed to call SurfaceFlinger surface ' + results[0]) 279 logging.warning('Failed to call SurfaceFlinger surface ' + results[0])
270 return { 280 return {
271 'page_flip_count': cur_surface, 281 'page_flip_count': cur_surface,
272 'timestamp': datetime.datetime.now(), 282 'timestamp': datetime.datetime.now(),
273 } 283 }
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