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

Unified Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc

Issue 2268163002: Add sub-metrics for Event.Latency.TouchToFirstScrollUpdateSwapBegin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: submetric Created 4 years, 1 month 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
Index: content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
index 549945ece38c4f4b4d0cc1df595fa47e64701246..813735f5ef18a538c801a5d8309cc2b3ba9dc2f2 100644
--- a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
+++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
@@ -28,9 +28,6 @@ void AddFakeComponentsWithTimeStamp(
latency->AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, time_stamp, 1);
latency->AddLatencyNumberWithTimestamp(
- ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
- tracker.latency_component_id(), 0, time_stamp, 1);
- latency->AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, 0, time_stamp, 1);
latency->AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0,
@@ -39,6 +36,9 @@ void AddFakeComponentsWithTimeStamp(
void AddFakeComponents(const RenderWidgetHostLatencyTracker& tracker,
ui::LatencyInfo* latency) {
+ latency->AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
+ tracker.latency_component_id(), 0, base::TimeTicks::Now(), 1);
AddFakeComponentsWithTimeStamp(tracker, latency, base::TimeTicks::Now());
}
@@ -95,7 +95,8 @@ class RenderWidgetHostLatencyTrackerTest : public testing::Test {
std::unique_ptr<base::HistogramTester> histogram_tester_;
RenderWidgetHostLatencyTracker tracker_;
};
-TEST_F(RenderWidgetHostLatencyTrackerTest, TestWheelHistograms) {
+
+TEST_F(RenderWidgetHostLatencyTrackerTest, TestWheelToFirstScrollHistograms) {
for (bool rendering_on_main : {false, true}) {
for (bool is_running_navigation_hint_task : {false, true}) {
ResetHistograms();
@@ -105,6 +106,9 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TestWheelHistograms) {
base::TimeTicks now = base::TimeTicks::Now();
wheel.timeStampSeconds = (now - base::TimeTicks()).InSecondsF();
ui::LatencyInfo wheel_latency(ui::SourceEventType::WHEEL);
+ wheel_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
+ tracker()->latency_component_id(), 0, now, 1);
AddFakeComponentsWithTimeStamp(*tracker(), &wheel_latency, now);
AddRenderingScheduledComponent(&wheel_latency, rendering_on_main, now);
tracker()->OnInputEvent(wheel, &wheel_latency);
@@ -122,9 +126,104 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TestWheelHistograms) {
EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1));
EXPECT_TRUE(
- HistogramSizeEq("Event.Latency.ScrollUpdate.Wheel."
- "TimeToFirstScrollUpdateSwapBegin2",
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel."
+ "TimeToScrollUpdateSwapBegin2",
1));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.TimeToHandled2_Main",
+ rendering_on_main ? 1 : 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.TimeToHandled2_Impl",
+ rendering_on_main ? 0 : 1));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.HandledToRendererSwap2_Main",
+ rendering_on_main ? 1 : 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.HandledToRendererSwap2_Impl",
+ rendering_on_main ? 0 : 1));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel."
+ "RendererSwapToBrowserNotified2",
+ 1));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel."
+ "BrowserNotifiedToBeforeGpuSwap2",
+ 1));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel.GpuSwap2", 1));
+
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Impl", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Wheel.HandledToRendererSwap2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Wheel.HandledToRendererSwap2_Impl", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Wheel.RendererSwapToBrowserNotified2",
+ 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Wheel.BrowserNotifiedToBeforeGpuSwap2",
+ 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollUpdate.Wheel.GpuSwap2", 0));
+ }
+ }
+ }
+}
+
+TEST_F(RenderWidgetHostLatencyTrackerTest, TestWheelToScrollHistograms) {
+ for (bool rendering_on_main : {false, true}) {
+ for (bool is_running_navigation_hint_task : {false, true}) {
+ ResetHistograms();
+ {
+ auto wheel = SyntheticWebMouseWheelEventBuilder::Build(
+ blink::WebMouseWheelEvent::PhaseChanged);
+ base::TimeTicks now = base::TimeTicks::Now();
+ wheel.timeStampSeconds = (now - base::TimeTicks()).InSecondsF();
+ ui::LatencyInfo wheel_latency(ui::SourceEventType::WHEEL);
+ wheel_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
+ tracker()->latency_component_id(), 0, now, 1);
+ AddFakeComponentsWithTimeStamp(*tracker(), &wheel_latency, now);
+ AddRenderingScheduledComponent(&wheel_latency, rendering_on_main, now);
+ tracker()->OnInputEvent(wheel, &wheel_latency);
+ EXPECT_TRUE(wheel_latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
+ tracker()->latency_component_id(), nullptr));
+ EXPECT_TRUE(wheel_latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
+ EXPECT_EQ(1U, wheel_latency.input_coordinates_size());
+ tracker()->OnInputEventAck(wheel, &wheel_latency,
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ tracker()->OnFrameSwapped(wheel_latency,
+ is_running_navigation_hint_task);
+ EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1));
+ EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1));
+
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel."
+ "TimeToScrollUpdateSwapBegin2",
+ 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.TimeToHandled2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.TimeToHandled2_Impl", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.HandledToRendererSwap2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Wheel.HandledToRendererSwap2_Impl", 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel."
+ "RendererSwapToBrowserNotified2",
+ 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel."
+ "BrowserNotifiedToBeforeGpuSwap2",
+ 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Wheel.GpuSwap2", 0));
EXPECT_TRUE(HistogramSizeEq(
"Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Main",
@@ -151,7 +250,7 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TestWheelHistograms) {
}
}
-TEST_F(RenderWidgetHostLatencyTrackerTest, TestTouchHistograms) {
+TEST_F(RenderWidgetHostLatencyTrackerTest, TestTouchToFirstScrollHistograms) {
for (bool rendering_on_main : {false, true}) {
for (bool is_running_navigation_hint_task : {false, true}) {
ResetHistograms();
@@ -161,6 +260,9 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TestTouchHistograms) {
base::TimeTicks now = base::TimeTicks::Now();
scroll.timeStampSeconds = (now - base::TimeTicks()).InSecondsF();
ui::LatencyInfo scroll_latency;
+ scroll_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
+ tracker()->latency_component_id(), 0, now, 1);
AddFakeComponentsWithTimeStamp(*tracker(), &scroll_latency, now);
AddRenderingScheduledComponent(&scroll_latency, rendering_on_main, now);
tracker()->OnInputEvent(scroll, &scroll_latency);
@@ -180,6 +282,9 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TestTouchHistograms) {
touch.PressPoint(1, 1);
ui::LatencyInfo touch_latency(ui::SourceEventType::TOUCH);
base::TimeTicks now = base::TimeTicks::Now();
+ touch_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
+ tracker()->latency_component_id(), 0, now, 1);
AddFakeComponentsWithTimeStamp(*tracker(), &touch_latency, now);
AddRenderingScheduledComponent(&touch_latency, rendering_on_main, now);
tracker()->OnInputEvent(touch, &touch_latency);
@@ -227,12 +332,127 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TestTouchHistograms) {
"Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1));
EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1));
EXPECT_TRUE(HistogramSizeEq(
- "Event.Latency.ScrollUpdate.Touch.TimeToFirstScrollUpdateSwapBegin2",
- 1));
+ "Event.Latency.ScrollBegin.Touch.TimeToScrollUpdateSwapBegin2", 1));
EXPECT_TRUE(HistogramSizeEq(
"Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch.TimeToHandled2_Main",
+ rendering_on_main ? 1 : 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch.TimeToHandled2_Impl",
+ rendering_on_main ? 0 : 1));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Touch.HandledToRendererSwap2_Main",
+ rendering_on_main ? 1 : 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Touch.HandledToRendererSwap2_Impl",
+ rendering_on_main ? 0 : 1));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch."
+ "RendererSwapToBrowserNotified2",
+ 1));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch."
+ "BrowserNotifiedToBeforeGpuSwap2",
+ 1));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch.GpuSwap2", 1));
+
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Impl", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Touch.HandledToRendererSwap2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Touch.HandledToRendererSwap2_Impl", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Touch.RendererSwapToBrowserNotified2",
+ 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Touch.BrowserNotifiedToBeforeGpuSwap2",
+ 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollUpdate.Touch.GpuSwap2", 0));
+ }
+ }
+}
+
+TEST_F(RenderWidgetHostLatencyTrackerTest, TestTouchToScrollHistograms) {
+ for (bool rendering_on_main : {false, true}) {
+ for (bool is_running_navigation_hint_task : {false, true}) {
+ ResetHistograms();
+ {
+ auto scroll = SyntheticWebGestureEventBuilder::BuildScrollUpdate(
+ 5.f, -5.f, 0, blink::WebGestureDeviceTouchscreen);
+ base::TimeTicks now = base::TimeTicks::Now();
+ scroll.timeStampSeconds = (now - base::TimeTicks()).InSecondsF();
+ ui::LatencyInfo scroll_latency;
+ scroll_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
+ tracker()->latency_component_id(), 0, now, 1);
+ AddFakeComponentsWithTimeStamp(*tracker(), &scroll_latency, now);
+ AddRenderingScheduledComponent(&scroll_latency, rendering_on_main, now);
+ tracker()->OnInputEvent(scroll, &scroll_latency);
+ EXPECT_TRUE(scroll_latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
+ tracker()->latency_component_id(), nullptr));
+ EXPECT_TRUE(scroll_latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
+ EXPECT_EQ(1U, scroll_latency.input_coordinates_size());
+ tracker()->OnInputEventAck(scroll, &scroll_latency,
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ }
+
+ {
+ SyntheticWebTouchEvent touch;
+ touch.PressPoint(0, 0);
+ touch.PressPoint(1, 1);
+ ui::LatencyInfo touch_latency(ui::SourceEventType::TOUCH);
+ base::TimeTicks now = base::TimeTicks::Now();
+ touch_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
+ tracker()->latency_component_id(), 0, now, 1);
+ AddFakeComponentsWithTimeStamp(*tracker(), &touch_latency, now);
+ AddRenderingScheduledComponent(&touch_latency, rendering_on_main, now);
+ tracker()->OnInputEvent(touch, &touch_latency);
+ EXPECT_TRUE(touch_latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
+ tracker()->latency_component_id(), nullptr));
+ EXPECT_TRUE(touch_latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
+ EXPECT_EQ(2U, touch_latency.input_coordinates_size());
+ tracker()->OnInputEventAck(touch, &touch_latency,
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ tracker()->OnFrameSwapped(touch_latency,
+ is_running_navigation_hint_task);
+ }
+
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Touch.TimeToScrollUpdateSwapBegin2", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", 1));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Touch.TimeToHandled2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Touch.TimeToHandled2_Impl", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Touch.HandledToRendererSwap2_Main", 0));
+ EXPECT_TRUE(HistogramSizeEq(
+ "Event.Latency.ScrollBegin.Touch.HandledToRendererSwap2_Impl", 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch."
+ "RendererSwapToBrowserNotified2",
+ 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch."
+ "BrowserNotifiedToBeforeGpuSwap2",
+ 0));
+ EXPECT_TRUE(
+ HistogramSizeEq("Event.Latency.ScrollBegin.Touch.GpuSwap2", 0));
+
EXPECT_TRUE(HistogramSizeEq(
"Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Main",
rendering_on_main ? 1 : 0));

Powered by Google App Engine
This is Rietveld 408576698