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

Unified Diff: tools/perf/metrics/rendering_stats.py

Issue 132433004: Collecting LatencyInfo in telemetry (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 11 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/metrics/smoothness.py » ('j') | tools/perf/metrics/smoothness.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/rendering_stats.py
diff --git a/tools/perf/metrics/rendering_stats.py b/tools/perf/metrics/rendering_stats.py
index ca3440b033448c3d8b5a58b78397bf95e0dbdce3..c11275f615a1081ad63266cae61800aaae136a9f 100644
--- a/tools/perf/metrics/rendering_stats.py
+++ b/tools/perf/metrics/rendering_stats.py
@@ -6,7 +6,7 @@ from operator import attrgetter
class RenderingStats(object):
- def __init__(self, renderer_process, timeline_ranges):
+ def __init__(self, renderer_process, browser_process, timeline_ranges):
"""
Utility class for extracting rendering statistics from the timeline (or
other loggin facilities), and providing them in a common format to classes
@@ -20,6 +20,7 @@ class RenderingStats(object):
"""
assert(len(timeline_ranges) > 0)
self.renderer_process = renderer_process
+ self.browser_process = browser_process
self.frame_timestamps = []
self.frame_times = []
@@ -29,12 +30,57 @@ class RenderingStats(object):
self.recorded_pixel_count = []
self.rasterize_time = []
self.rasterized_pixel_count = []
+ self.mouse_wheel_latency = []
+ self.gesture_scroll_latency = []
+ self.touch_scroll_latency = []
for timeline_range in timeline_ranges:
if timeline_range.is_empty:
continue
self.initMainThreadStatsFromTimeline(timeline_range)
self.initImplThreadStatsFromTimeline(timeline_range)
+ self.initInputLatencyFromTimeline(timeline_range)
+
+ def initInputLatencyFromTimeline(self, timeline_range):
nduca 2014/01/13 18:49:32 needs unit tests too
Yufeng Shen (Slow to review) 2014/01/14 00:05:47 unittests added in tools/perf/metrics/rendering_s
+ event_name = "InputLatency"
+ ui_comp_name = 'INPUT_EVENT_LATENCY_UI_COMPONENT'
+ begin_comp_name = 'INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT'
+ end_comp_name = 'INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT'
+ mouse_wheel_events = []
+ scroll_events = []
+ for event in self.browser_process.IterAllAsyncSlicesOfName(event_name):
+ if event.start >= timeline_range.min and event.end <= timeline_range.max:
+ for ss in event.sub_slices:
+ if 'step' not in ss.args:
+ continue
+ if 'data' not in ss.args:
+ continue
+ if ss.args['step'] == 'MouseWheel':
+ mouse_wheel_events.append(ss)
+ elif ss.args['step'] == 'GestureScrollUpdate':
+ scroll_events.append(ss)
+
+ # mouse_wheel_latency is the time from when mouse wheel event reaches RWH
+ # to buffer swapped.
+ for event in mouse_wheel_events:
+ data = event.args['data']
+ if begin_comp_name in data and end_comp_name in data:
+ latency = data[end_comp_name]['time'] - data[begin_comp_name]['time']
+ self.mouse_wheel_latency.append(latency / 1000.0)
+
+ # gesture_scroll_latency is the time from when gesture scroll event reaches
+ # RWH to buffer swapped. It is available on all platforms.
+ # touch_scroll_latency is the time from when the touch event reaches browser
+ # to when the buffer swapped due to the scroll generated from the original
+ # touch event. This is only available in Aura currently.
+ for event in scroll_events:
+ data = event.args['data']
+ if begin_comp_name in data and end_comp_name in data:
+ latency = data[end_comp_name]['time'] - data[begin_comp_name]['time']
+ self.gesture_scroll_latency.append(latency / 1000.0)
+ if ui_comp_name in data and end_comp_name in data:
+ latency = data[end_comp_name]['time'] - data[ui_comp_name]['time']
+ self.touch_scroll_latency.append(latency / 1000.0)
def initMainThreadStatsFromTimeline(self, timeline_range):
event_name = 'BenchmarkInstrumentation::MainThreadRenderingStats'
« no previous file with comments | « no previous file | tools/perf/metrics/smoothness.py » ('j') | tools/perf/metrics/smoothness.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698