diff options
author | miletus <miletus@chromium.org> | 2015-04-23 09:49:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-23 16:49:18 +0000 |
commit | b9b173506b58fcd490850d6f08a70decbf6cb54d (patch) | |
tree | f74d597ce9255992b5270d84026bf83906b7a477 | |
parent | a5e585868e16ce53c990f764d4943592f11749aa (diff) | |
download | chromium_src-b9b173506b58fcd490850d6f08a70decbf6cb54d.zip chromium_src-b9b173506b58fcd490850d6f08a70decbf6cb54d.tar.gz chromium_src-b9b173506b58fcd490850d6f08a70decbf6cb54d.tar.bz2 |
Rename InputLatency::ScrollUpdate to Latency::ScrollUpdate
Sometimes it is confusing to see ScrollUpdate slippage is traced
under name InputLatency. Lets rename it to be Latency::ScrollUpdate.
BUG=None
Review URL: https://codereview.chromium.org/1096413002
Cr-Commit-Position: refs/heads/master@{#326548}
-rw-r--r-- | cc/trees/latency_info_swap_promise_monitor.cc | 2 | ||||
-rw-r--r-- | tools/telemetry/telemetry/web_perf/metrics/rendering_stats.py | 44 | ||||
-rw-r--r-- | tools/telemetry/telemetry/web_perf/metrics/rendering_stats_unittest.py | 18 | ||||
-rw-r--r-- | ui/events/latency_info.cc | 32 | ||||
-rw-r--r-- | ui/events/latency_info.h | 6 |
5 files changed, 59 insertions, 43 deletions
diff --git a/cc/trees/latency_info_swap_promise_monitor.cc b/cc/trees/latency_info_swap_promise_monitor.cc index 2b56f68..c63ac5b 100644 --- a/cc/trees/latency_info_swap_promise_monitor.cc +++ b/cc/trees/latency_info_swap_promise_monitor.cc @@ -83,7 +83,7 @@ void LatencyInfoSwapPromiseMonitor::OnForwardScrollUpdateToMainThreadOnImpl() { return; ui::LatencyInfo new_latency; new_latency.AddLatencyNumberWithTraceName( - ui::INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, 0, + ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, 0, new_sequence_number, "ScrollUpdate"); new_latency.CopyLatencyFrom( *latency_, diff --git a/tools/telemetry/telemetry/web_perf/metrics/rendering_stats.py b/tools/telemetry/telemetry/web_perf/metrics/rendering_stats.py index 231f23e..cd76e9f 100644 --- a/tools/telemetry/telemetry/web_perf/metrics/rendering_stats.py +++ b/tools/telemetry/telemetry/web_perf/metrics/rendering_stats.py @@ -1,6 +1,8 @@ # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import itertools + from operator import attrgetter from telemetry.web_perf.metrics import rendering_frame @@ -15,7 +17,7 @@ ORIGINAL_COMP_NAME = 'INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT' BEGIN_COMP_NAME = 'INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT' # This is when an input event is turned into a scroll update. BEGIN_SCROLL_UPDATE_COMP_NAME = ( - 'INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT') + 'LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT') # This is when a scroll update is forwarded to the main thread. FORWARD_SCROLL_UPDATE_COMP_NAME = ( 'INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT') @@ -23,7 +25,7 @@ FORWARD_SCROLL_UPDATE_COMP_NAME = ( END_COMP_NAME = 'INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT' # Name for a main thread scroll update latency event. -SCROLL_UPDATE_EVENT_NAME = 'InputLatency::ScrollUpdate' +SCROLL_UPDATE_EVENT_NAME = 'Latency::ScrollUpdate' # Name for a gesture scroll update latency event. GESTURE_SCROLL_UPDATE_EVENT_NAME = 'InputLatency::GestureScrollUpdate' @@ -38,27 +40,30 @@ APPROXIMATED_PIXEL_ERROR = 'approximated_pixel_percentages' CHECKERBOARDED_PIXEL_ERROR = 'checkerboarded_pixel_percentages' -def GetInputLatencyEvents(process, timeline_range): - """Get input events' LatencyInfo from the process's trace buffer that are +def GetLatencyEvents(process, timeline_range): + """Get LatencyInfo trace events from the process's trace buffer that are within the timeline_range. Input events dump their LatencyInfo into trace buffer as async trace event - of name starting with "InputLatency". The trace event has a memeber 'data' - containing its latency history. + of name starting with "InputLatency". Non-input events with name starting + with "Latency". The trace event has a memeber 'data' containing its latency + history. """ - input_events = [] + latency_events = [] if not process: - return input_events - for event in process.IterAllAsyncSlicesStartsWithName('InputLatency'): + return latency_events + for event in itertools.chain( + process.IterAllAsyncSlicesStartsWithName('InputLatency'), + process.IterAllAsyncSlicesStartsWithName('Latency')): if event.start >= timeline_range.min and event.end <= timeline_range.max: for ss in event.sub_slices: if 'data' in ss.args: - input_events.append(ss) - return input_events + latency_events.append(ss) + return latency_events -def ComputeInputEventLatencies(input_events): +def ComputeEventLatencies(input_events): """ Compute input event latencies. Input event latency is the time from when the input event is created to @@ -71,7 +76,7 @@ def ComputeInputEventLatencies(input_events): 3. INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT -- when event reaches RenderWidget If the latency starts with a - INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT component, then it is + LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT component, then it is classified as a scroll update instead of a normal input latency measure. Returns: @@ -200,22 +205,21 @@ class RenderingStats(object): def _InitInputLatencyStatsFromTimeline( self, browser_process, renderer_process, timeline_range): - latency_events = GetInputLatencyEvents(browser_process, timeline_range) + latency_events = GetLatencyEvents(browser_process, timeline_range) # Plugin input event's latency slice is generated in renderer process. - latency_events.extend(GetInputLatencyEvents(renderer_process, - timeline_range)) - input_event_latencies = ComputeInputEventLatencies(latency_events) + latency_events.extend(GetLatencyEvents(renderer_process, timeline_range)) + event_latencies = ComputeEventLatencies(latency_events) # Don't include scroll updates in the overall input latency measurement, # because scroll updates can take much more time to process than other # input events and would therefore add noise to overall latency numbers. self.input_event_latency[-1] = [ - latency for name, latency in input_event_latencies + latency for name, latency in event_latencies if name != SCROLL_UPDATE_EVENT_NAME] self.scroll_update_latency[-1] = [ - latency for name, latency in input_event_latencies + latency for name, latency in event_latencies if name == SCROLL_UPDATE_EVENT_NAME] self.gesture_scroll_update_latency[-1] = [ - latency for name, latency in input_event_latencies + latency for name, latency in event_latencies if name == GESTURE_SCROLL_UPDATE_EVENT_NAME] def _GatherEvents(self, event_name, process, timeline_range): diff --git a/tools/telemetry/telemetry/web_perf/metrics/rendering_stats_unittest.py b/tools/telemetry/telemetry/web_perf/metrics/rendering_stats_unittest.py index 7f78bd5..5755ecd 100644 --- a/tools/telemetry/telemetry/web_perf/metrics/rendering_stats_unittest.py +++ b/tools/telemetry/telemetry/web_perf/metrics/rendering_stats_unittest.py @@ -20,10 +20,10 @@ from telemetry.web_perf.metrics.rendering_stats import ( SCROLL_UPDATE_EVENT_NAME, UI_COMP_NAME) from telemetry.web_perf.metrics.rendering_stats import ( - ComputeInputEventLatencies) -from telemetry.web_perf.metrics.rendering_stats import GetInputLatencyEvents -from telemetry.web_perf.metrics.rendering_stats import HasRenderingStats -from telemetry.web_perf.metrics.rendering_stats import RenderingStats + ComputeEventLatencies, + GetLatencyEvents, + HasRenderingStats, + RenderingStats) class MockTimer(object): @@ -512,7 +512,7 @@ class RenderingStatsUnitTest(unittest.TestCase): browser.FinalizeImport() renderer.FinalizeImport() - input_events = [] + latency_events = [] timeline_markers = timeline.FindTimelineMarkers( ['ActionA', 'ActionB', 'ActionA']) @@ -521,11 +521,11 @@ class RenderingStatsUnitTest(unittest.TestCase): for timeline_range in timeline_ranges: if timeline_range.is_empty: continue - input_events.extend(GetInputLatencyEvents(browser, timeline_range)) + latency_events.extend(GetLatencyEvents(browser, timeline_range)) - self.assertEquals(input_events, ref_latency.input_event) - input_event_latency_result = ComputeInputEventLatencies(input_events) - self.assertEquals(input_event_latency_result, + self.assertEquals(latency_events, ref_latency.input_event) + event_latency_result = ComputeEventLatencies(latency_events) + self.assertEquals(event_latency_result, ref_latency.input_event_latency) stats = RenderingStats(renderer, browser, None, timeline_ranges) diff --git a/ui/events/latency_info.cc b/ui/events/latency_info.cc index 112cc46..24f12d4 100644 --- a/ui/events/latency_info.cc +++ b/ui/events/latency_info.cc @@ -22,7 +22,7 @@ const char* GetComponentName(ui::LatencyComponentType type) { switch (type) { CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT); - CASE_TYPE(INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT); + CASE_TYPE(LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); @@ -71,7 +71,12 @@ bool IsTerminalComponent(ui::LatencyComponentType type) { bool IsBeginComponent(ui::LatencyComponentType type) { return (type == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || type == ui::INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT || - type == ui::INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT); + type == ui::LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT); +} + +bool IsInputLatencyBeginComponent(ui::LatencyComponentType type) { + return (type == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT || + type == ui::INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT); } // This class is for converting latency info to trace buffer friendly format. @@ -251,9 +256,6 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl( const unsigned char* benchmark_enabled = g_benchmark_enabled.Get().benchmark_enabled; - if (*benchmark_enabled && trace_name_str) - trace_name = trace_name_str; - if (IsBeginComponent(component)) { // Should only ever add begin component once. CHECK_EQ(-1, trace_id); @@ -265,14 +267,14 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl( // for an input event, we want to draw the beginning as when the event is // originally created, e.g. the timestamp of its ORIGINAL/UI_COMPONENT, // not when we actually issue the ASYNC_BEGIN trace event. - LatencyComponent component; + LatencyComponent begin_component; int64 ts = 0; if (FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, - &component) || + &begin_component) || FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, - &component)) { + &begin_component)) { // The timestamp stored in ORIGINAL/UI_COMPONENT is using clock // CLOCK_MONOTONIC while TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0 // expects timestamp using CLOCK_MONOTONIC or CLOCK_SYSTEM_TRACE (on @@ -281,13 +283,21 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl( // can't use a static value. int64 diff = base::TimeTicks::Now().ToInternalValue() - base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); - ts = component.event_time.ToInternalValue() - diff; + ts = begin_component.event_time.ToInternalValue() - diff; } else { ts = base::TimeTicks::NowFromSystemTraceTime().ToInternalValue(); } + + if (trace_name_str) { + if (IsInputLatencyBeginComponent(component)) + trace_name = std::string("InputLatency::") + trace_name_str; + else + trace_name = std::string("Latency::") + trace_name_str; + } + TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0( "benchmark", - ("InputLatency::" + trace_name).c_str(), + trace_name.c_str(), TRACE_ID_DONT_MANGLE(trace_id), ts); } @@ -322,7 +332,7 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl( if (*benchmark_enabled) { TRACE_EVENT_COPY_ASYNC_END1("benchmark", - ("InputLatency::" + trace_name).c_str(), + trace_name.c_str(), TRACE_ID_DONT_MANGLE(trace_id), "data", AsTraceableData(*this)); } diff --git a/ui/events/latency_info.h b/ui/events/latency_info.h index 1c6ceef..ffc9bdbd 100644 --- a/ui/events/latency_info.h +++ b/ui/events/latency_info.h @@ -23,8 +23,10 @@ enum LatencyComponentType { INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, // Timestamp when the input event is received in plugin. INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, - // Timestamp when a scroll update for the main thread is begun. - INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, + // In threaded scrolling, main thread scroll listener update is async to + // scroll processing in impl thread. This is the timestamp when we consider + // the main thread scroll listener update is begun. + LATENCY_BEGIN_SCROLL_LISTENER_UPDATE_MAIN_COMPONENT, // ---------------------------NORMAL COMPONENT------------------------------- // The original timestamp of the touch event which converts to scroll update. INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, |