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

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

Issue 153743008: Revert of Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging with changes to pylib/linker/test_case.py. Created 6 years, 10 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 def SampleResults(self): 65 def SampleResults(self):
66 self._StorePerfResults() 66 self._StorePerfResults()
67 results = self.GetResults() 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 or self._GetEmptyResults() 72 return self._results or self._GetEmptyResults()
73 73
74 @staticmethod 74 def _GetEmptyResults(self):
75 def _GetEmptyResults():
76 return [ 75 return [
77 SurfaceStatsCollector.Result('refresh_period', None, 'seconds'), 76 SurfaceStatsCollector.Result('refresh_period', None, 'seconds'),
78 SurfaceStatsCollector.Result('jank_count', None, 'janks'), 77 SurfaceStatsCollector.Result('jank_count', None, 'janks'),
79 SurfaceStatsCollector.Result('max_frame_delay', None, 'vsyncs'), 78 SurfaceStatsCollector.Result('max_frame_delay', None, 'vsyncs'),
80 SurfaceStatsCollector.Result('frame_lengths', None, 'vsyncs'), 79 SurfaceStatsCollector.Result('frame_lengths', None, 'vsyncs'),
81 SurfaceStatsCollector.Result('avg_surface_fps', None, 'fps') 80 SurfaceStatsCollector.Result('avg_surface_fps', None, 'fps')
82 ] 81 ]
83 82
84 @staticmethod 83 @staticmethod
85 def _GetNormalizedDeltas(data, refresh_period, min_normalized_delta=None): 84 def _GetNormalizedDeltas(data, refresh_period, min_normalized_delta=None):
(...skipping 10 matching lines...) Expand all
96 seconds = timestamps[-1] - timestamps[0] 95 seconds = timestamps[-1] - timestamps[0]
97 96
98 frame_lengths, normalized_frame_lengths = \ 97 frame_lengths, normalized_frame_lengths = \
99 SurfaceStatsCollector._GetNormalizedDeltas( 98 SurfaceStatsCollector._GetNormalizedDeltas(
100 timestamps, refresh_period, _MIN_NORMALIZED_FRAME_LENGTH) 99 timestamps, refresh_period, _MIN_NORMALIZED_FRAME_LENGTH)
101 if len(frame_lengths) < frame_count - 1: 100 if len(frame_lengths) < frame_count - 1:
102 logging.warning('Skipping frame lengths that are too short.') 101 logging.warning('Skipping frame lengths that are too short.')
103 frame_count = len(frame_lengths) + 1 102 frame_count = len(frame_lengths) + 1
104 if len(frame_lengths) == 0: 103 if len(frame_lengths) == 0:
105 raise Exception('No valid frames lengths found.') 104 raise Exception('No valid frames lengths found.')
106 _length_changes, normalized_changes = \ 105 length_changes, normalized_changes = \
107 SurfaceStatsCollector._GetNormalizedDeltas( 106 SurfaceStatsCollector._GetNormalizedDeltas(
108 frame_lengths, refresh_period) 107 frame_lengths, refresh_period)
109 jankiness = [max(0, round(change)) for change in normalized_changes] 108 jankiness = [max(0, round(change)) for change in normalized_changes]
110 pause_threshold = 20 109 pause_threshold = 20
111 jank_count = sum(1 for change in jankiness 110 jank_count = sum(1 for change in jankiness
112 if change > 0 and change < pause_threshold) 111 if change > 0 and change < pause_threshold)
113 return [ 112 return [
114 SurfaceStatsCollector.Result( 113 SurfaceStatsCollector.Result(
115 'avg_surface_fps' + result_suffix, 114 'avg_surface_fps' + result_suffix,
116 int(round((frame_count - 1) / seconds)), 'fps'), 115 int(round((frame_count - 1) / seconds)), 'fps'),
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 try: 298 try:
300 cur_surface = int(match.group(1), 16) 299 cur_surface = int(match.group(1), 16)
301 except Exception: 300 except Exception:
302 logging.error('Failed to parse current surface from ' + match.group(1)) 301 logging.error('Failed to parse current surface from ' + match.group(1))
303 else: 302 else:
304 logging.warning('Failed to call SurfaceFlinger surface ' + results[0]) 303 logging.warning('Failed to call SurfaceFlinger surface ' + results[0])
305 return { 304 return {
306 'page_flip_count': cur_surface, 305 'page_flip_count': cur_surface,
307 'timestamp': datetime.datetime.now(), 306 'timestamp': datetime.datetime.now(),
308 } 307 }
OLDNEW
« no previous file with comments | « build/android/pylib/perf/setup.py ('k') | build/android/pylib/perf/surface_stats_collector_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698