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_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, | 241 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, |
242 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, | 242 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, |
243 int64_t latency_component_id, | 243 int64_t latency_component_id, |
244 const ui::LatencyInfo& latency, | 244 const ui::LatencyInfo& latency, |
245 const std::string event_type_name) { | 245 const std::string event_type_name) { |
246 DCHECK(!latency.coalesced()); | 246 DCHECK(!latency.coalesced()); |
247 if (latency.coalesced()) | 247 if (latency.coalesced()) |
248 return; | 248 return; |
249 | 249 |
250 LatencyInfo::LatencyComponent original_component; | 250 LatencyInfo::LatencyComponent original_component; |
| 251 std::string scroll_name = "ScrollUpdate"; |
251 if (latency.FindLatency( | 252 if (latency.FindLatency( |
252 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 253 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
253 latency_component_id, &original_component)) { | 254 latency_component_id, &original_component)) { |
| 255 scroll_name = "ScrollBegin"; |
254 // This UMA metric tracks the time between the final frame swap for the | 256 // This UMA metric tracks the time between the final frame swap for the |
255 // first scroll event in a sequence and the original timestamp of that | 257 // first scroll event in a sequence and the original timestamp of that |
256 // scroll event's underlying touch/wheel event. | 258 // scroll event's underlying touch/wheel event. |
| 259 |
257 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( | 260 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( |
258 "Event.Latency.ScrollUpdate." + event_type_name + | 261 "Event.Latency.ScrollBegin." + event_type_name + |
259 ".TimeToFirstScrollUpdateSwapBegin2", | 262 ".TimeToScrollUpdateSwapBegin2", |
260 original_component, gpu_swap_begin_component); | 263 original_component, gpu_swap_begin_component); |
261 } else if (latency.FindLatency( | 264 } else if (latency.FindLatency( |
262 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 265 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
263 latency_component_id, &original_component)) { | 266 latency_component_id, &original_component)) { |
264 // This UMA metric tracks the time from when the original touch event is | 267 // This UMA metric tracks the time from when the original touch event is |
265 // created to when the scroll gesture results in final frame swap. | 268 // created to when the scroll gesture results in final frame swap. |
266 // First scroll events are excluded from this metric. | 269 // First scroll events are excluded from this metric. |
267 if (event_type_name == "Touch") { | 270 if (event_type_name == "Touch") { |
268 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( | 271 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( |
269 "Event.Latency.ScrollUpdate." + event_type_name + | 272 "Event.Latency.ScrollUpdate." + event_type_name + |
(...skipping 12 matching lines...) Expand all Loading... |
282 if (!rendering_scheduled_on_main) { | 285 if (!rendering_scheduled_on_main) { |
283 if (!latency.FindLatency( | 286 if (!latency.FindLatency( |
284 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, | 287 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, |
285 &rendering_scheduled_component)) | 288 &rendering_scheduled_component)) |
286 return; | 289 return; |
287 } | 290 } |
288 | 291 |
289 const std::string thread_name = rendering_scheduled_on_main ? "Main" : "Impl"; | 292 const std::string thread_name = rendering_scheduled_on_main ? "Main" : "Impl"; |
290 | 293 |
291 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( | 294 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( |
292 "Event.Latency.ScrollUpdate." + event_type_name + | 295 "Event.Latency." + scroll_name + "." + event_type_name + |
293 ".TimeToHandled2_" + thread_name, | 296 ".TimeToHandled2_" + thread_name, |
294 original_component, rendering_scheduled_component); | 297 original_component, rendering_scheduled_component); |
295 | 298 |
296 LatencyInfo::LatencyComponent renderer_swap_component; | 299 LatencyInfo::LatencyComponent renderer_swap_component; |
297 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, | 300 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, |
298 &renderer_swap_component)) | 301 &renderer_swap_component)) |
299 return; | 302 return; |
300 | 303 |
301 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( | 304 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( |
302 "Event.Latency.ScrollUpdate." + event_type_name + | 305 "Event.Latency." + scroll_name + "." + event_type_name + |
303 ".HandledToRendererSwap2_" + thread_name, | 306 ".HandledToRendererSwap2_" + thread_name, |
304 rendering_scheduled_component, renderer_swap_component); | 307 rendering_scheduled_component, renderer_swap_component); |
305 | 308 |
306 LatencyInfo::LatencyComponent browser_received_swap_component; | 309 LatencyInfo::LatencyComponent browser_received_swap_component; |
307 if (!latency.FindLatency( | 310 if (!latency.FindLatency( |
308 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, | 311 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, |
309 &browser_received_swap_component)) | 312 &browser_received_swap_component)) |
310 return; | 313 return; |
311 | 314 |
312 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( | 315 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( |
313 "Event.Latency.ScrollUpdate." + event_type_name + | 316 "Event.Latency." + scroll_name + "." + event_type_name + |
314 ".RendererSwapToBrowserNotified2", | 317 ".RendererSwapToBrowserNotified2", |
315 renderer_swap_component, browser_received_swap_component); | 318 renderer_swap_component, browser_received_swap_component); |
316 | 319 |
317 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( | 320 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( |
318 "Event.Latency.ScrollUpdate." + event_type_name + | 321 "Event.Latency." + scroll_name + "." + event_type_name + |
319 ".BrowserNotifiedToBeforeGpuSwap2", | 322 ".BrowserNotifiedToBeforeGpuSwap2", |
320 browser_received_swap_component, gpu_swap_begin_component); | 323 browser_received_swap_component, gpu_swap_begin_component); |
321 | 324 |
322 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( | 325 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( |
323 "Event.Latency.ScrollUpdate." + event_type_name + ".GpuSwap2", | 326 "Event.Latency." + scroll_name + "." + event_type_name + ".GpuSwap2", |
324 gpu_swap_begin_component, gpu_swap_end_component); | 327 gpu_swap_begin_component, gpu_swap_end_component); |
325 } | 328 } |
326 // LatencyComponents generated in the renderer must have component IDs | 329 // LatencyComponents generated in the renderer must have component IDs |
327 // provided to them by the browser process. This function adds the correct | 330 // provided to them by the browser process. This function adds the correct |
328 // component ID where necessary. | 331 // component ID where necessary. |
329 void AddLatencyInfoComponentIds(LatencyInfo* latency, | 332 void AddLatencyInfoComponentIds(LatencyInfo* latency, |
330 int64_t latency_component_id) { | 333 int64_t latency_component_id) { |
331 std::vector<std::pair<ui::LatencyComponentType, int64_t>> new_components_key; | 334 std::vector<std::pair<ui::LatencyComponentType, int64_t>> new_components_key; |
332 std::vector<LatencyInfo::LatencyComponent> new_components_value; | 335 std::vector<LatencyInfo::LatencyComponent> new_components_value; |
333 for (const auto& lc : latency->latency_components()) { | 336 for (const auto& lc : latency->latency_components()) { |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 if (!latency.FindLatency( | 716 if (!latency.FindLatency( |
714 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, | 717 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, |
715 &mouse_wheel_scroll_update_component)) { | 718 &mouse_wheel_scroll_update_component)) { |
716 ComputeScrollLatencyHistograms( | 719 ComputeScrollLatencyHistograms( |
717 gpu_swap_begin_component, gpu_swap_end_component, latency_component_id_, | 720 gpu_swap_begin_component, gpu_swap_end_component, latency_component_id_, |
718 latency, is_running_navigation_hint_task); | 721 latency, is_running_navigation_hint_task); |
719 } | 722 } |
720 } | 723 } |
721 | 724 |
722 } // namespace content | 725 } // namespace content |
OLD | NEW |