Commit 7d166055 authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

latency: Remove another unnecessary component.

The INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT component is set from the
browser, and immediately looked up in the same cycle. So remove the
component, and use the timestamp directly instead.

BUG=849719

Change-Id: Id28352d7ad0f56c5b0b89df26c9aa45d3d190f55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2093019
Commit-Queue: Ken Buchanan <kenrb@chromium.org>
Auto-Submit: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748271}
parent 9e13a828
...@@ -91,7 +91,9 @@ RenderWidgetHostLatencyTracker::~RenderWidgetHostLatencyTracker() {} ...@@ -91,7 +91,9 @@ RenderWidgetHostLatencyTracker::~RenderWidgetHostLatencyTracker() {}
void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms(
WebInputEvent::Type type, WebInputEvent::Type type,
const LatencyInfo& latency, const LatencyInfo& latency,
InputEventAckState ack_result) { InputEventAckState ack_result,
base::TimeTicks ack_timestamp) {
DCHECK(!ack_timestamp.is_null());
// If this event was coalesced into another event, ignore it, as the event it // If this event was coalesced into another event, ignore it, as the event it
// was coalesced into will reflect the full latency. // was coalesced into will reflect the full latency.
if (latency.coalesced()) if (latency.coalesced())
...@@ -144,14 +146,10 @@ void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( ...@@ -144,14 +146,10 @@ void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms(
} }
} }
base::TimeTicks rwh_ack_timestamp; if (!multi_finger_touch_gesture && !main_thread_timestamp.is_null()) {
if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
&rwh_ack_timestamp)) { "Event.Latency.BlockingTime." + event_name + default_action_status,
if (!multi_finger_touch_gesture && !main_thread_timestamp.is_null()) { main_thread_timestamp, ack_timestamp);
UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
"Event.Latency.BlockingTime." + event_name + default_action_status,
main_thread_timestamp, rwh_ack_timestamp);
}
} }
} }
...@@ -252,7 +250,6 @@ void RenderWidgetHostLatencyTracker::OnInputEventAck( ...@@ -252,7 +250,6 @@ void RenderWidgetHostLatencyTracker::OnInputEventAck(
} }
} }
latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT);
// If this event couldn't have caused a gesture event, and it didn't trigger // If this event couldn't have caused a gesture event, and it didn't trigger
// rendering, we're done processing it. If the event got coalesced then // rendering, we're done processing it. If the event got coalesced then
// terminate it as well. We also exclude cases where we're against the scroll // terminate it as well. We also exclude cases where we're against the scroll
...@@ -263,7 +260,8 @@ void RenderWidgetHostLatencyTracker::OnInputEventAck( ...@@ -263,7 +260,8 @@ void RenderWidgetHostLatencyTracker::OnInputEventAck(
latency->Terminate(); latency->Terminate();
} }
ComputeInputLatencyHistograms(event.GetType(), *latency, ack_result); ComputeInputLatencyHistograms(event.GetType(), *latency, ack_result,
base::TimeTicks::Now());
} }
void RenderWidgetHostLatencyTracker::OnEventStart(ui::LatencyInfo* latency) { void RenderWidgetHostLatencyTracker::OnEventStart(ui::LatencyInfo* latency) {
......
...@@ -29,7 +29,8 @@ class CONTENT_EXPORT RenderWidgetHostLatencyTracker { ...@@ -29,7 +29,8 @@ class CONTENT_EXPORT RenderWidgetHostLatencyTracker {
void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type, void ComputeInputLatencyHistograms(blink::WebInputEvent::Type type,
const ui::LatencyInfo& latency, const ui::LatencyInfo& latency,
InputEventAckState ack_result); InputEventAckState ack_result,
base::TimeTicks ack_timestamp);
// Populates the LatencyInfo with relevant entries for latency tracking. // Populates the LatencyInfo with relevant entries for latency tracking.
// Called when an event is received by the RenderWidgetHost, prior to // Called when an event is received by the RenderWidgetHost, prior to
......
...@@ -972,18 +972,15 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) { ...@@ -972,18 +972,15 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) {
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1])); base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1]));
fake_latency.AddLatencyNumberWithTimestamp( auto ack_timestamp =
ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2])); base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]);
// Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
// overwriting components. // overwriting components.
tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
blocking); blocking, ack_timestamp);
tracker()->OnInputEventAck(event, &latency, blocking);
tracker()->OnInputEventAck(event, &latency,
blocking);
} }
{ {
...@@ -1013,15 +1010,14 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) { ...@@ -1013,15 +1010,14 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) {
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[1])); base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[1]));
fake_latency.AddLatencyNumberWithTimestamp( auto ack_timestamp =
ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2])); base::TimeDelta::FromMilliseconds(touchmove_timestamps_ms[2]);
// Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
// overwriting components. // overwriting components.
tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
blocking); blocking, ack_timestamp);
} }
{ {
...@@ -1051,15 +1047,14 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) { ...@@ -1051,15 +1047,14 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) {
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[1])); base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[1]));
fake_latency.AddLatencyNumberWithTimestamp( auto ack_timestamp =
ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2])); base::TimeDelta::FromMilliseconds(touchend_timestamps_ms[2]);
// Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
// overwriting components. // overwriting components.
tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
blocking); blocking, ack_timestamp);
} }
} }
...@@ -1149,15 +1144,14 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, KeyBlockingAndQueueingTime) { ...@@ -1149,15 +1144,14 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, KeyBlockingAndQueueingTime) {
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(event_timestamps_ms[1])); base::TimeDelta::FromMilliseconds(event_timestamps_ms[1]));
fake_latency.AddLatencyNumberWithTimestamp( auto ack_timestamp =
ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(event_timestamps_ms[2])); base::TimeDelta::FromMilliseconds(event_timestamps_ms[2]);
// Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
// overwriting components. // overwriting components.
tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency, tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
blocking); blocking, ack_timestamp);
tracker()->OnInputEventAck(event, &latency_info, blocking); tracker()->OnInputEventAck(event, &latency_info, blocking);
} }
...@@ -1252,15 +1246,13 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, ...@@ -1252,15 +1246,13 @@ TEST_F(RenderWidgetHostLatencyTrackerTest,
base::TimeTicks() + base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1])); base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1]));
fake_latency.AddLatencyNumberWithTimestamp( auto ack_timestamp = base::TimeTicks() + base::TimeDelta::FromMilliseconds(
ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, touchstart_timestamps_ms[2]);
base::TimeTicks() +
base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]));
// Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
// overwriting components. // overwriting components.
tracker()->ComputeInputLatencyHistograms(event.GetType(), tracker()->ComputeInputLatencyHistograms(event.GetType(), fake_latency,
fake_latency, ack_state); ack_state, ack_timestamp);
tracker()->OnInputEventAck(event, &latency, ack_state); tracker()->OnInputEventAck(event, &latency, ack_state);
} }
......
...@@ -36,7 +36,6 @@ const char* GetComponentName(ui::LatencyComponentType type) { ...@@ -36,7 +36,6 @@ const char* GetComponentName(ui::LatencyComponentType type) {
CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT);
CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT);
CASE_TYPE(DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT); CASE_TYPE(DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT);
......
...@@ -65,8 +65,6 @@ enum LatencyComponentType { ...@@ -65,8 +65,6 @@ enum LatencyComponentType {
INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT,
// Original timestamp of the last event that has been coalesced into this one. // Original timestamp of the last event that has been coalesced into this one.
INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT, INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT,
// Timestamp when the event's ack is received by the RWH.
INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
// Timestamp when the frame is swapped in renderer. // Timestamp when the frame is swapped in renderer.
INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
// Timestamp of when the display compositor receives a compositor frame from // Timestamp of when the display compositor receives a compositor frame from
......
...@@ -31,8 +31,6 @@ enum LatencyComponentType { ...@@ -31,8 +31,6 @@ enum LatencyComponentType {
INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT,
// Timestamp for last event that has been coalesced into this one. // Timestamp for last event that has been coalesced into this one.
INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT, INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT,
// Timestamp when the event's ack is received by the RWH.
INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
// Timestamp when the frame is swapped in renderer. // Timestamp when the frame is swapped in renderer.
INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
// Timestamp of when the display compositor receives a compositor frame. // Timestamp of when the display compositor receives a compositor frame.
......
...@@ -169,9 +169,6 @@ EnumTraits<ui::mojom::LatencyComponentType, ui::LatencyComponentType>::ToMojom( ...@@ -169,9 +169,6 @@ EnumTraits<ui::mojom::LatencyComponentType, ui::LatencyComponentType>::ToMojom(
case ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT: case ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT:
return ui::mojom::LatencyComponentType:: return ui::mojom::LatencyComponentType::
INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT; INPUT_EVENT_LATENCY_SCROLL_UPDATE_LAST_EVENT_COMPONENT;
case ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT:
return ui::mojom::LatencyComponentType::
INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT;
case ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT: case ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT:
return ui::mojom::LatencyComponentType:: return ui::mojom::LatencyComponentType::
INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT; INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT;
...@@ -225,9 +222,6 @@ bool EnumTraits<ui::mojom::LatencyComponentType, ui::LatencyComponentType>:: ...@@ -225,9 +222,6 @@ bool EnumTraits<ui::mojom::LatencyComponentType, ui::LatencyComponentType>::
INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT: INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT:
*output = ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT; *output = ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT;
return true; return true;
case ui::mojom::LatencyComponentType::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT:
*output = ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT;
return true;
case ui::mojom::LatencyComponentType:: case ui::mojom::LatencyComponentType::
INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT: INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT:
*output = ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT; *output = ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment