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

Unified 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: All stats 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/perf/measurements/smoothness.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/surface_stats_collector.py
diff --git a/build/android/pylib/surface_stats_collector.py b/build/android/pylib/surface_stats_collector.py
index d5709fffe7d72159f45e5824cfcf075fc8f949e4..5b1281b4ec0a335f69747b2095d2c05864f5dd7d 100644
--- a/build/android/pylib/surface_stats_collector.py
+++ b/build/android/pylib/surface_stats_collector.py
@@ -85,6 +85,45 @@ class SurfaceStatsCollector(object):
deltas = [t2 - t1 for t1, t2 in zip(data, data[1:])]
return (deltas, [delta / refresh_period for delta in deltas])
+ @staticmethod
+ def _CalculateResults(refresh_period, timestamps, result_suffix):
+ """Returns a list of SurfaceStatsCollector.Result."""
+ frame_count = len(timestamps)
+ seconds = timestamps[-1] - timestamps[0]
+
+ frame_lengths, normalized_frame_lengths = \
+ SurfaceStatsCollector._GetNormalizedDeltas(timestamps, refresh_period)
+ length_changes, normalized_changes = \
+ SurfaceStatsCollector._GetNormalizedDeltas(
+ frame_lengths, refresh_period)
+ jankiness = [max(0, round(change)) for change in normalized_changes]
+ pause_threshold = 20
+ jank_count = sum(1 for change in jankiness
+ if change > 0 and change < pause_threshold)
+ return [
+ SurfaceStatsCollector.Result(
+ 'avg_surface_fps' + result_suffix,
+ int(round(frame_count / seconds)), 'fps'),
+ SurfaceStatsCollector.Result(
+ 'jank_count' + result_suffix, jank_count, 'janks'),
+ SurfaceStatsCollector.Result(
+ 'max_frame_delay' + result_suffix,
+ round(max(normalized_frame_lengths)),
+ 'vsyncs'),
+ SurfaceStatsCollector.Result(
+ 'frame_lengths' + result_suffix, normalized_frame_lengths,
+ 'vsyncs'),
+ ]
+
+ @staticmethod
+ def _CalculateBuckets(refresh_period, timestamps):
+ results = []
+ for pct in [0.99, 0.5]:
+ sliced = timestamps[int(-pct * len(timestamps)) + 3 : ]
+ results += SurfaceStatsCollector._CalculateResults(
+ refresh_period, sliced, '_' + str(int(pct * 100)))
+ return results
+
def _StorePerfResults(self):
if self._use_legacy_method:
surface_after = self._GetSurfaceStatsLegacy()
@@ -92,36 +131,21 @@ class SurfaceStatsCollector(object):
seconds = td.seconds + td.microseconds / 1e6
frame_count = (surface_after['page_flip_count'] -
self._surface_before['page_flip_count'])
- else:
- assert self._collector_thread
- (refresh_period, timestamps) = self._GetDataFromThread()
- if not refresh_period or not len(timestamps) >= 3:
- if self._warn_about_empty_data:
- logging.warning('Surface stat data is empty')
- return
- frame_count = len(timestamps)
- seconds = timestamps[-1] - timestamps[0]
-
- frame_lengths, normalized_frame_lengths = \
- self._GetNormalizedDeltas(timestamps, refresh_period)
- length_changes, normalized_changes = \
- self._GetNormalizedDeltas(frame_lengths, refresh_period)
- jankiness = [max(0, round(change)) for change in normalized_changes]
- pause_threshold = 20
- jank_count = sum(1 for change in jankiness
- if change > 0 and change < pause_threshold)
-
- self._results.append(SurfaceStatsCollector.Result(
- 'refresh_period', refresh_period, 'seconds'))
- self._results.append(SurfaceStatsCollector.Result(
- 'jank_count', jank_count, 'janks'))
- self._results.append(SurfaceStatsCollector.Result(
- 'max_frame_delay', round(max(normalized_frame_lengths)),
- 'vsyncs'))
self._results.append(SurfaceStatsCollector.Result(
- 'frame_lengths', normalized_frame_lengths, 'vsyncs'))
+ 'avg_surface_fps', int(round(frame_count / seconds)), 'fps'))
+ return
+
+ # Non-legacy method.
+ assert self._collector_thread
+ (refresh_period, timestamps) = self._GetDataFromThread()
+ if not refresh_period or not len(timestamps) >= 3:
+ if self._warn_about_empty_data:
+ logging.warning('Surface stat data is empty')
+ return
self._results.append(SurfaceStatsCollector.Result(
- 'avg_surface_fps', int(round(frame_count / seconds)), 'fps'))
+ 'refresh_period', refresh_period, 'seconds'))
+ self._results += self._CalculateResults(refresh_period, timestamps, '')
+ self._results += self._CalculateBuckets(refresh_period, timestamps)
def _CollectorThread(self):
last_timestamp = 0
« no previous file with comments | « no previous file | tools/perf/measurements/smoothness.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698