OLD | NEW |
---|---|
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when | 120 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when |
121 // the experimentation finished (crbug.com/638827). | 121 // the experimentation finished (crbug.com/638827). |
122 if (is_running_navigation_hint_task) { | 122 if (is_running_navigation_hint_task) { |
123 for (size_t i = 0; i < original_component.event_count; i++) { | 123 for (size_t i = 0; i < original_component.event_count; i++) { |
124 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( | 124 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( |
125 "Event.Latency.TouchToFirstScrollUpdateSwapBegin_" | 125 "Event.Latency.TouchToFirstScrollUpdateSwapBegin_" |
126 "IsRunningNavigationHintTask", | 126 "IsRunningNavigationHintTask", |
127 original_component, gpu_swap_begin_component); | 127 original_component, gpu_swap_begin_component); |
128 } | 128 } |
129 } | 129 } |
130 | |
131 // TODO(miletus): Add validation for making sure the following components | |
132 // are present and their event times are legit. | |
tdresser
2016/08/23 13:57:00
miletus doesn't work here anymore.
I assume this
lanwei
2016/08/24 03:08:28
Done.
| |
133 LatencyInfo::LatencyComponent rendering_scheduled_component; | |
134 bool rendering_scheduled_on_main = latency.FindLatency( | |
135 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, | |
136 &rendering_scheduled_component); | |
137 | |
138 if (!rendering_scheduled_on_main) { | |
139 if (!latency.FindLatency( | |
140 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, | |
141 &rendering_scheduled_component)) | |
142 goto allScrollUpdate; | |
tdresser
2016/08/23 13:57:00
Rewrite without using goto.
It's barely mentioned
lanwei
2016/08/24 03:08:28
Done.
| |
143 } | |
144 | |
145 if (rendering_scheduled_on_main) { | |
146 UMA_HISTOGRAM_SCROLL_LATENCY_LONG( | |
147 "Event.Latency.FirstScrollUpdate.FirstTouchToHandled_Main", | |
148 original_component, rendering_scheduled_component); | |
149 } else { | |
150 UMA_HISTOGRAM_SCROLL_LATENCY_LONG( | |
151 "Event.Latency.FirstScrollUpdate.FirstTouchToHandled_Impl", | |
152 original_component, rendering_scheduled_component); | |
153 } | |
154 | |
155 LatencyInfo::LatencyComponent renderer_swap_component; | |
156 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, | |
157 &renderer_swap_component)) | |
158 goto allScrollUpdate; | |
159 | |
160 if (rendering_scheduled_on_main) { | |
161 UMA_HISTOGRAM_SCROLL_LATENCY_LONG( | |
162 "Event.Latency.FirstScrollUpdate.HandledToRendererSwap_Main", | |
163 rendering_scheduled_component, renderer_swap_component); | |
164 } else { | |
165 UMA_HISTOGRAM_SCROLL_LATENCY_LONG( | |
166 "Event.Latency.FirstScrollUpdate.HandledToRendererSwap_Impl", | |
167 rendering_scheduled_component, renderer_swap_component); | |
168 } | |
169 | |
170 LatencyInfo::LatencyComponent browser_received_swap_component; | |
171 if (!latency.FindLatency( | |
172 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, | |
173 &browser_received_swap_component)) | |
174 goto allScrollUpdate; | |
175 | |
176 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT( | |
177 "Event.Latency.FirstScrollUpdate.RendererSwapToBrowserNotified", | |
178 renderer_swap_component, browser_received_swap_component); | |
179 | |
180 UMA_HISTOGRAM_SCROLL_LATENCY_LONG( | |
181 "Event.Latency.FirstScrollUpdate.BrowserNotifiedToBeforeGpuSwap", | |
182 browser_received_swap_component, gpu_swap_begin_component); | |
183 | |
184 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT( | |
185 "Event.Latency.FirstScrollUpdate.GpuSwap", gpu_swap_begin_component, | |
186 gpu_swap_end_component); | |
130 } else if (!latency.FindLatency( | 187 } else if (!latency.FindLatency( |
131 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 188 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
132 latency_component_id, &original_component)) { | 189 latency_component_id, &original_component)) { |
133 return; | 190 return; |
134 } | 191 } |
135 | 192 |
193 allScrollUpdate: | |
136 // This UMA metric tracks the time from when the original touch event is | 194 // This UMA metric tracks the time from when the original touch event is |
137 // created to when the scroll gesture results in final frame swap. | 195 // created to when the scroll gesture results in final frame swap. |
138 for (size_t i = 0; i < original_component.event_count; i++) { | 196 for (size_t i = 0; i < original_component.event_count; i++) { |
139 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( | 197 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( |
140 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component, | 198 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component, |
141 gpu_swap_begin_component); | 199 gpu_swap_begin_component); |
142 } | 200 } |
143 // TODO(horo): IsRunningNavigationHintTask UMAs are only for | 201 // TODO(horo): IsRunningNavigationHintTask UMAs are only for |
144 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when | 202 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when |
145 // the experimentation finished (crbug.com/638827). | 203 // the experimentation finished (crbug.com/638827). |
146 if (is_running_navigation_hint_task) { | 204 if (is_running_navigation_hint_task) { |
147 for (size_t i = 0; i < original_component.event_count; i++) { | 205 for (size_t i = 0; i < original_component.event_count; i++) { |
148 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( | 206 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( |
149 "Event.Latency.TouchToScrollUpdateSwapBegin_" | 207 "Event.Latency.TouchToScrollUpdateSwapBegin_" |
150 "IsRunningNavigationHintTask", | 208 "IsRunningNavigationHintTask", |
151 original_component, gpu_swap_begin_component); | 209 original_component, gpu_swap_begin_component); |
152 } | 210 } |
153 } | 211 } |
154 | 212 |
155 // TODO(miletus): Add validation for making sure the following components | 213 // TODO(miletus): Add validation for making sure the following components |
156 // are present and their event times are legit. | 214 // are present and their event times are legit. |
157 LatencyInfo::LatencyComponent rendering_scheduled_component; | 215 LatencyInfo::LatencyComponent rendering_scheduled_component; |
158 bool rendering_scheduled_on_main = latency.FindLatency( | 216 bool rendering_scheduled_on_main = latency.FindLatency( |
159 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, | 217 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, |
160 0, &rendering_scheduled_component); | 218 0, &rendering_scheduled_component); |
161 | |
162 if (!rendering_scheduled_on_main) { | 219 if (!rendering_scheduled_on_main) { |
163 if (!latency.FindLatency( | 220 if (!latency.FindLatency( |
164 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, | 221 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, |
165 0, &rendering_scheduled_component)) | 222 0, &rendering_scheduled_component)) |
166 return; | 223 return; |
167 } | 224 } |
168 | 225 |
169 if (rendering_scheduled_on_main) { | 226 if (rendering_scheduled_on_main) { |
170 UMA_HISTOGRAM_SCROLL_LATENCY_LONG( | 227 UMA_HISTOGRAM_SCROLL_LATENCY_LONG( |
171 "Event.Latency.ScrollUpdate.TouchToHandled_Main", | 228 "Event.Latency.ScrollUpdate.TouchToHandled_Main", |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 latency_component_id_, nullptr)) { | 650 latency_component_id_, nullptr)) { |
594 return; | 651 return; |
595 } | 652 } |
596 | 653 |
597 ComputeScrollLatencyHistograms(gpu_swap_begin_component, | 654 ComputeScrollLatencyHistograms(gpu_swap_begin_component, |
598 gpu_swap_end_component, latency_component_id_, | 655 gpu_swap_end_component, latency_component_id_, |
599 latency, is_running_navigation_hint_task); | 656 latency, is_running_navigation_hint_task); |
600 } | 657 } |
601 | 658 |
602 } // namespace content | 659 } // namespace content |
OLD | NEW |