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

Unified Diff: build/android/pylib/surface_stats_collector.py

Issue 13046007: android: Add interactive surface statistics viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow more than one bad timestamp. Created 7 years, 9 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 | build/android/surface_stats.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 fbd4e40c7aed06290a1b3e5f8c75e8494dce6956..38284b1ce5c1cab5c870f209bf3fbcacaea7c1f8 100644
--- a/build/android/pylib/surface_stats_collector.py
+++ b/build/android/pylib/surface_stats_collector.py
@@ -37,6 +37,10 @@ class SurfaceStatsCollector(object):
self._data_queue = None
self._stop_event = None
self._results = []
+ self._warn_about_empty_data = True
+
+ def DisableWarningAboutEmptyData(self):
+ self._warn_about_empty_data = False
def Start(self):
assert not self._collector_thread
@@ -58,6 +62,12 @@ class SurfaceStatsCollector(object):
self._collector_thread.join()
self._collector_thread = None
+ def SampleResults(self):
+ self._StorePerfResults()
+ results = self._results
+ self._results = []
+ return results
+
def GetResults(self):
return self._results
@@ -77,7 +87,8 @@ class SurfaceStatsCollector(object):
assert self._collector_thread
(refresh_period, timestamps) = self._GetDataFromThread()
if not refresh_period or not len(timestamps) >= 3:
- logging.warning('Surface stat data is empty')
+ if self._warn_about_empty_data:
+ logging.warning('Surface stat data is empty')
return
frame_count = len(timestamps)
seconds = timestamps[-1] - timestamps[0]
@@ -208,11 +219,19 @@ class SurfaceStatsCollector(object):
nanoseconds_per_second = 1e9
refresh_period = long(results[0]) / nanoseconds_per_second
+ # SurfaceFlinger sometimes gives an invalid timestamp for the very latest
+ # frame if it is queried while the frame is still being presented. We ignore
+ # these timestamps.
+ bad_timestamp = (1 << 63) - 1
+
for line in results[1:]:
fields = line.split()
if len(fields) != 3:
continue
- timestamp = long(fields[1]) / nanoseconds_per_second
+ timestamp = long(fields[1])
+ if timestamp == bad_timestamp:
+ continue
+ timestamp /= nanoseconds_per_second
timestamps.append(timestamp)
return (refresh_period, timestamps)
« no previous file with comments | « no previous file | build/android/surface_stats.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698