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

Side by Side Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker.cc

Issue 2211783003: Track input latency while starting a ServiceWorker for a navigation hint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h" 5 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT(name, start, end) \ 89 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT(name, start, end) \
90 UMA_HISTOGRAM_CUSTOM_COUNTS( \ 90 UMA_HISTOGRAM_CUSTOM_COUNTS( \
91 name, \ 91 name, \
92 (end.event_time - start.event_time).InMicroseconds(), \ 92 (end.event_time - start.event_time).InMicroseconds(), \
93 1, 50000, 50) 93 1, 50000, 50)
94 94
95 void ComputeScrollLatencyHistograms( 95 void ComputeScrollLatencyHistograms(
96 const LatencyInfo::LatencyComponent& gpu_swap_begin_component, 96 const LatencyInfo::LatencyComponent& gpu_swap_begin_component,
97 const LatencyInfo::LatencyComponent& gpu_swap_end_component, 97 const LatencyInfo::LatencyComponent& gpu_swap_end_component,
98 int64_t latency_component_id, 98 int64_t latency_component_id,
99 const LatencyInfo& latency) { 99 const LatencyInfo& latency,
100 bool is_running_navigation_hint_task) {
100 DCHECK(!latency.coalesced()); 101 DCHECK(!latency.coalesced());
101 if (latency.coalesced()) 102 if (latency.coalesced())
102 return; 103 return;
103 104
104 DCHECK(!gpu_swap_begin_component.event_time.is_null()); 105 DCHECK(!gpu_swap_begin_component.event_time.is_null());
105 DCHECK(!gpu_swap_end_component.event_time.is_null()); 106 DCHECK(!gpu_swap_end_component.event_time.is_null());
106 LatencyInfo::LatencyComponent original_component; 107 LatencyInfo::LatencyComponent original_component;
107 if (latency.FindLatency( 108 if (latency.FindLatency(
108 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, 109 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT,
109 latency_component_id, &original_component)) { 110 latency_component_id, &original_component)) {
110 // This UMA metric tracks the time between the final frame swap for the 111 // This UMA metric tracks the time between the final frame swap for the
111 // first scroll event in a sequence and the original timestamp of that 112 // first scroll event in a sequence and the original timestamp of that
112 // scroll event's underlying touch event. 113 // scroll event's underlying touch event.
113 for (size_t i = 0; i < original_component.event_count; i++) { 114 for (size_t i = 0; i < original_component.event_count; i++) {
114 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( 115 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY(
115 "Event.Latency.TouchToFirstScrollUpdateSwapBegin", 116 "Event.Latency.TouchToFirstScrollUpdateSwapBegin",
116 original_component, gpu_swap_begin_component); 117 original_component, gpu_swap_begin_component);
117 } 118 }
119 if (is_running_navigation_hint_task) {
120 for (size_t i = 0; i < original_component.event_count; i++) {
121 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY(
122 "Event.Latency.TouchToFirstScrollUpdateSwapBegin."
shimazu 2016/08/16 09:46:21 According the top of histograms.xml, I thought "..
horo 2016/08/16 12:31:43 I don't know well about the regulations of what se
123 "IsRunningNavigationHintTask",
124 original_component, gpu_swap_begin_component);
125 }
126 }
118 } else if (!latency.FindLatency( 127 } else if (!latency.FindLatency(
119 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, 128 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT,
120 latency_component_id, &original_component)) { 129 latency_component_id, &original_component)) {
121 return; 130 return;
122 } 131 }
123 132
124 // This UMA metric tracks the time from when the original touch event is 133 // This UMA metric tracks the time from when the original touch event is
125 // created to when the scroll gesture results in final frame swap. 134 // created to when the scroll gesture results in final frame swap.
126 for (size_t i = 0; i < original_component.event_count; i++) { 135 for (size_t i = 0; i < original_component.event_count; i++) {
127 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( 136 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY(
128 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component, 137 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component,
129 gpu_swap_begin_component); 138 gpu_swap_begin_component);
130 } 139 }
140 if (is_running_navigation_hint_task) {
141 for (size_t i = 0; i < original_component.event_count; i++) {
142 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY(
143 "Event.Latency.TouchToScrollUpdateSwapBegin."
144 "IsRunningNavigationHintTask",
145 original_component, gpu_swap_begin_component);
146 }
147 }
131 148
132 // TODO(miletus): Add validation for making sure the following components 149 // TODO(miletus): Add validation for making sure the following components
133 // are present and their event times are legit. 150 // are present and their event times are legit.
134 LatencyInfo::LatencyComponent rendering_scheduled_component; 151 LatencyInfo::LatencyComponent rendering_scheduled_component;
135 bool rendering_scheduled_on_main = latency.FindLatency( 152 bool rendering_scheduled_on_main = latency.FindLatency(
136 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 153 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT,
137 0, &rendering_scheduled_component); 154 0, &rendering_scheduled_component);
138 155
139 if (!rendering_scheduled_on_main) { 156 if (!rendering_scheduled_on_main) {
140 if (!latency.FindLatency( 157 if (!latency.FindLatency(
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 std::vector<LatencyInfo>* latencies) { 541 std::vector<LatencyInfo>* latencies) {
525 DCHECK(latencies); 542 DCHECK(latencies);
526 for (LatencyInfo& latency : *latencies) { 543 for (LatencyInfo& latency : *latencies) {
527 AddLatencyInfoComponentIds(&latency, latency_component_id_); 544 AddLatencyInfoComponentIds(&latency, latency_component_id_);
528 latency.AddLatencyNumber( 545 latency.AddLatencyNumber(
529 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0); 546 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0);
530 } 547 }
531 } 548 }
532 549
533 void RenderWidgetHostLatencyTracker::OnFrameSwapped( 550 void RenderWidgetHostLatencyTracker::OnFrameSwapped(
534 const LatencyInfo& latency) { 551 const LatencyInfo& latency,
552 bool is_running_navigation_hint_task) {
535 // Don't report frame latency on wheel events. Previously they were only 553 // Don't report frame latency on wheel events. Previously they were only
536 // reported on touch metrics and we need to be consistent across reporting 554 // reported on touch metrics and we need to be consistent across reporting
537 // metrics. 555 // metrics.
538 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component; 556 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component;
539 if (latency.FindLatency( 557 if (latency.FindLatency(
540 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, 558 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0,
541 &mouse_wheel_scroll_update_component)) { 559 &mouse_wheel_scroll_update_component)) {
542 return; 560 return;
543 } 561 }
544 562
(...skipping 20 matching lines...) Expand all
565 } 583 }
566 } 584 }
567 585
568 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 586 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
569 latency_component_id_, nullptr)) { 587 latency_component_id_, nullptr)) {
570 return; 588 return;
571 } 589 }
572 590
573 ComputeScrollLatencyHistograms(gpu_swap_begin_component, 591 ComputeScrollLatencyHistograms(gpu_swap_begin_component,
574 gpu_swap_end_component, latency_component_id_, 592 gpu_swap_end_component, latency_component_id_,
575 latency); 593 latency, is_running_navigation_hint_task);
576 } 594 }
577 595
578 } // namespace content 596 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698