Chromium Code Reviews| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 latency, device_scale_factor); | 68 latency, device_scale_factor); |
| 69 } else if (WebInputEvent::isTouchEventType(event.type)) { | 69 } else if (WebInputEvent::isTouchEventType(event.type)) { |
| 70 UpdateLatencyCoordinatesImpl(static_cast<const WebTouchEvent&>(event), | 70 UpdateLatencyCoordinatesImpl(static_cast<const WebTouchEvent&>(event), |
| 71 latency, device_scale_factor); | 71 latency, device_scale_factor); |
| 72 } else if (event.type == WebInputEvent::MouseWheel) { | 72 } else if (event.type == WebInputEvent::MouseWheel) { |
| 73 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseWheelEvent&>(event), | 73 UpdateLatencyCoordinatesImpl(static_cast<const WebMouseWheelEvent&>(event), |
| 74 latency, device_scale_factor); | 74 latency, device_scale_factor); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Touch to scroll latency that is mostly under 1 second. | 78 // Check valid timing for start and end latency components. |
| 79 #define UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY(name, start, end) \ | 79 #define CONFIRM_VALID_TIMING(start, end) \ |
| 80 UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 80 DCHECK(!start.first_event_time.is_null()); \ |
| 81 name, (end.event_time - start.event_time).InMicroseconds(), 1, 1000000, \ | 81 DCHECK(!end.last_event_time.is_null()); \ |
| 82 100) | 82 DCHECK_GE(end.last_event_time, start.first_event_time); |
| 83 | |
| 84 // Event latency that is mostly under 1 second. We should only use 100 buckets | |
| 85 // when needed. | |
| 86 #define UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(name, start, \ | |
| 87 end) \ | |
| 88 CONFIRM_VALID_TIMING(start, end) \ | |
| 89 base::Histogram::FactoryGet(name, 1, 1000000, 100, \ | |
|
dtapuska
2016/12/15 14:54:49
How does this not leak memory?
| |
| 90 base::HistogramBase::kUmaTargetedHistogramFlag) \ | |
| 91 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); | |
| 92 | |
| 93 #define UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(name, start, end) \ | |
| 94 CONFIRM_VALID_TIMING(start, end) \ | |
| 95 base::Histogram::FactoryGet(name, 1, 1000, 50, \ | |
| 96 base::HistogramBase::kUmaTargetedHistogramFlag) \ | |
| 97 ->Add((end.last_event_time - start.first_event_time).InMilliseconds()); | |
| 83 | 98 |
| 84 // Long scroll latency component that is mostly under 200ms. | 99 // Long scroll latency component that is mostly under 200ms. |
| 85 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG(name, start, end) \ | 100 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG(name, start, end) \ |
| 86 UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 101 UMA_HISTOGRAM_CUSTOM_COUNTS( \ |
| 87 name, \ | 102 name, \ |
| 88 (end.event_time - start.event_time).InMicroseconds(), \ | 103 (end.event_time - start.event_time).InMicroseconds(), \ |
| 89 1000, 200000, 50) | 104 1000, 200000, 50) |
| 90 | 105 |
| 91 // Short scroll latency component that is mostly under 50ms. | 106 // Short scroll latency component that is mostly under 50ms. |
| 92 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT(name, start, end) \ | 107 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT(name, start, end) \ |
| 93 UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 108 UMA_HISTOGRAM_CUSTOM_COUNTS( \ |
| 94 name, \ | 109 name, \ |
| 95 (end.event_time - start.event_time).InMicroseconds(), \ | 110 (end.event_time - start.event_time).InMicroseconds(), \ |
| 96 1, 50000, 50) | 111 1, 50000, 50) |
| 97 | 112 |
| 98 // Check valid timing for start and end latency components. | |
| 99 #define CONFIRM_VALID_TIMING(start, end) \ | |
| 100 DCHECK(!start.first_event_time.is_null()); \ | |
| 101 DCHECK(!end.last_event_time.is_null()); \ | |
| 102 DCHECK_GE(end.last_event_time, start.first_event_time); | |
| 103 | |
| 104 // Touch/wheel to scroll latency that is mostly under 1 second. | |
| 105 #define UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY(name, start, end) \ | |
| 106 CONFIRM_VALID_TIMING(start, end) \ | |
| 107 base::Histogram::FactoryGet(name, 1, 1000000, 100, \ | |
| 108 base::HistogramBase::kUmaTargetedHistogramFlag) \ | |
| 109 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); | |
| 110 | |
| 111 // Long touch/wheel scroll latency component that is mostly under 200ms. | 113 // Long touch/wheel scroll latency component that is mostly under 200ms. |
| 112 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(name, start, end) \ | 114 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(name, start, end) \ |
| 113 CONFIRM_VALID_TIMING(start, end) \ | 115 CONFIRM_VALID_TIMING(start, end) \ |
| 114 base::Histogram::FactoryGet(name, 1000, 200000, 50, \ | 116 base::Histogram::FactoryGet(name, 1000, 200000, 50, \ |
| 115 base::HistogramBase::kUmaTargetedHistogramFlag) \ | 117 base::HistogramBase::kUmaTargetedHistogramFlag) \ |
| 116 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); | 118 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); |
| 117 | 119 |
| 118 // Short touch/wheel scroll latency component that is mostly under 50ms. | 120 // Short touch/wheel scroll latency component that is mostly under 50ms. |
| 119 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(name, start, end) \ | 121 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(name, start, end) \ |
| 120 CONFIRM_VALID_TIMING(start, end) \ | 122 CONFIRM_VALID_TIMING(start, end) \ |
| 121 base::Histogram::FactoryGet(name, 1, 50000, 50, \ | 123 base::Histogram::FactoryGet(name, 1, 50000, 50, \ |
| 122 base::HistogramBase::kUmaTargetedHistogramFlag) \ | 124 base::HistogramBase::kUmaTargetedHistogramFlag) \ |
| 123 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); | 125 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); |
| 124 | 126 |
| 127 std::string LatencySourceEventTypeToInputModalityString( | |
| 128 ui::SourceEventType type) { | |
| 129 switch (type) { | |
| 130 case ui::SourceEventType::WHEEL: | |
| 131 return "Wheel"; | |
| 132 case ui::SourceEventType::TOUCH: | |
| 133 return "Touch"; | |
| 134 default: | |
| 135 return ""; | |
| 136 } | |
| 137 } | |
| 138 | |
| 139 std::string WebInputEventTypeToInputModalityString(WebInputEvent::Type type) { | |
| 140 if (type == blink::WebInputEvent::MouseWheel) { | |
| 141 return "Wheel"; | |
| 142 } else if (WebInputEvent::isKeyboardEventType(type)) { | |
| 143 return "Key"; | |
| 144 } else if (WebInputEvent::isMouseEventType(type)) { | |
| 145 return "Mouse"; | |
| 146 } else if (WebInputEvent::isTouchEventType(type)) { | |
| 147 return "Touch"; | |
| 148 } | |
| 149 return ""; | |
| 150 } | |
| 151 | |
| 125 void ComputeScrollLatencyHistograms( | 152 void ComputeScrollLatencyHistograms( |
| 126 const LatencyInfo::LatencyComponent& gpu_swap_begin_component, | 153 const LatencyInfo::LatencyComponent& gpu_swap_begin_component, |
| 127 const LatencyInfo::LatencyComponent& gpu_swap_end_component, | 154 const LatencyInfo::LatencyComponent& gpu_swap_end_component, |
| 128 int64_t latency_component_id, | 155 int64_t latency_component_id, |
| 129 const LatencyInfo& latency, | 156 const LatencyInfo& latency, |
| 130 bool is_running_navigation_hint_task) { | 157 bool is_running_navigation_hint_task) { |
| 131 DCHECK(!latency.coalesced()); | 158 DCHECK(!latency.coalesced()); |
| 132 if (latency.coalesced()) | 159 if (latency.coalesced()) |
| 133 return; | 160 return; |
| 134 | 161 |
| 135 DCHECK(!gpu_swap_begin_component.event_time.is_null()); | 162 DCHECK(!gpu_swap_begin_component.event_time.is_null()); |
| 136 DCHECK(!gpu_swap_end_component.event_time.is_null()); | 163 DCHECK(!gpu_swap_end_component.event_time.is_null()); |
| 137 LatencyInfo::LatencyComponent original_component; | 164 LatencyInfo::LatencyComponent original_component; |
| 138 if (latency.FindLatency( | 165 if (latency.FindLatency( |
| 139 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 166 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
| 140 latency_component_id, &original_component)) { | 167 latency_component_id, &original_component)) { |
| 141 // This UMA metric tracks the time between the final frame swap for the | 168 // This UMA metric tracks the time between the final frame swap for the |
| 142 // first scroll event in a sequence and the original timestamp of that | 169 // first scroll event in a sequence and the original timestamp of that |
| 143 // scroll event's underlying touch event. | 170 // scroll event's underlying touch event. |
| 144 for (size_t i = 0; i < original_component.event_count; i++) { | 171 for (size_t i = 0; i < original_component.event_count; i++) { |
| 145 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( | 172 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 146 "Event.Latency.TouchToFirstScrollUpdateSwapBegin", | 173 "Event.Latency.TouchToFirstScrollUpdateSwapBegin", |
| 147 original_component, gpu_swap_begin_component); | 174 original_component, gpu_swap_begin_component); |
| 148 } | 175 } |
| 149 // TODO(horo): IsRunningNavigationHintTask UMAs are only for | 176 // TODO(horo): IsRunningNavigationHintTask UMAs are only for |
| 150 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when | 177 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when |
| 151 // the experimentation finished (crbug.com/638827). | 178 // the experimentation finished (crbug.com/638827). |
| 152 if (is_running_navigation_hint_task) { | 179 if (is_running_navigation_hint_task) { |
| 153 for (size_t i = 0; i < original_component.event_count; i++) { | 180 for (size_t i = 0; i < original_component.event_count; i++) { |
| 154 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( | 181 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 155 "Event.Latency.TouchToFirstScrollUpdateSwapBegin_" | 182 "Event.Latency.TouchToFirstScrollUpdateSwapBegin_" |
| 156 "IsRunningNavigationHintTask", | 183 "IsRunningNavigationHintTask", |
| 157 original_component, gpu_swap_begin_component); | 184 original_component, gpu_swap_begin_component); |
| 158 } | 185 } |
| 159 } | 186 } |
| 160 } else if (!latency.FindLatency( | 187 } else if (!latency.FindLatency( |
| 161 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 188 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
| 162 latency_component_id, &original_component)) { | 189 latency_component_id, &original_component)) { |
| 163 return; | 190 return; |
| 164 } | 191 } |
| 165 | 192 |
| 166 // This UMA metric tracks the time from when the original touch event is | 193 // This UMA metric tracks the time from when the original touch event is |
| 167 // created to when the scroll gesture results in final frame swap. | 194 // created to when the scroll gesture results in final frame swap. |
| 168 for (size_t i = 0; i < original_component.event_count; i++) { | 195 for (size_t i = 0; i < original_component.event_count; i++) { |
| 169 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( | 196 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 170 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component, | 197 "Event.Latency.TouchToScrollUpdateSwapBegin", original_component, |
| 171 gpu_swap_begin_component); | 198 gpu_swap_begin_component); |
| 172 } | 199 } |
| 173 // TODO(horo): IsRunningNavigationHintTask UMAs are only for | 200 // TODO(horo): IsRunningNavigationHintTask UMAs are only for |
| 174 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when | 201 // SpeculativeLaunchServiceWorker experimentation. So remove this UMA when |
| 175 // the experimentation finished (crbug.com/638827). | 202 // the experimentation finished (crbug.com/638827). |
| 176 if (is_running_navigation_hint_task) { | 203 if (is_running_navigation_hint_task) { |
| 177 for (size_t i = 0; i < original_component.event_count; i++) { | 204 for (size_t i = 0; i < original_component.event_count; i++) { |
| 178 UMA_HISTOGRAM_TOUCH_TO_SCROLL_LATENCY( | 205 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 179 "Event.Latency.TouchToScrollUpdateSwapBegin_" | 206 "Event.Latency.TouchToScrollUpdateSwapBegin_" |
| 180 "IsRunningNavigationHintTask", | 207 "IsRunningNavigationHintTask", |
| 181 original_component, gpu_swap_begin_component); | 208 original_component, gpu_swap_begin_component); |
| 182 } | 209 } |
| 183 } | 210 } |
| 184 | 211 |
| 185 // TODO(miletus): Add validation for making sure the following components | 212 // TODO(miletus): Add validation for making sure the following components |
| 186 // are present and their event times are legit. | 213 // are present and their event times are legit. |
| 187 LatencyInfo::LatencyComponent rendering_scheduled_component; | 214 LatencyInfo::LatencyComponent rendering_scheduled_component; |
| 188 bool rendering_scheduled_on_main = latency.FindLatency( | 215 bool rendering_scheduled_on_main = latency.FindLatency( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT("Event.Latency.ScrollUpdate.GpuSwap", | 265 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT("Event.Latency.ScrollUpdate.GpuSwap", |
| 239 gpu_swap_begin_component, | 266 gpu_swap_begin_component, |
| 240 gpu_swap_end_component); | 267 gpu_swap_end_component); |
| 241 } | 268 } |
| 242 | 269 |
| 243 void ComputeTouchAndWheelScrollLatencyHistograms( | 270 void ComputeTouchAndWheelScrollLatencyHistograms( |
| 244 RenderWidgetHostDelegate* render_widget_host_delegate, | 271 RenderWidgetHostDelegate* render_widget_host_delegate, |
| 245 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, | 272 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, |
| 246 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, | 273 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, |
| 247 int64_t latency_component_id, | 274 int64_t latency_component_id, |
| 248 const ui::LatencyInfo& latency, | 275 const ui::LatencyInfo& latency) { |
| 249 const std::string event_type_name) { | |
| 250 DCHECK(!latency.coalesced()); | 276 DCHECK(!latency.coalesced()); |
| 251 if (latency.coalesced()) | 277 if (latency.coalesced()) |
| 252 return; | 278 return; |
| 253 | 279 |
| 254 LatencyInfo::LatencyComponent original_component; | 280 LatencyInfo::LatencyComponent original_component; |
| 255 std::string scroll_name = "ScrollUpdate"; | 281 std::string scroll_name = "ScrollUpdate"; |
| 282 | |
| 283 const std::string input_modality = | |
| 284 LatencySourceEventTypeToInputModalityString(latency.source_event_type()); | |
| 285 | |
| 256 if (latency.FindLatency( | 286 if (latency.FindLatency( |
| 257 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 287 ui::INPUT_EVENT_LATENCY_FIRST_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
| 258 latency_component_id, &original_component)) { | 288 latency_component_id, &original_component)) { |
| 259 scroll_name = "ScrollBegin"; | 289 scroll_name = "ScrollBegin"; |
| 260 // This UMA metric tracks the time between the final frame swap for the | 290 // This UMA metric tracks the time between the final frame swap for the |
| 261 // first scroll event in a sequence and the original timestamp of that | 291 // first scroll event in a sequence and the original timestamp of that |
| 262 // scroll event's underlying touch/wheel event. | 292 // scroll event's underlying touch/wheel event. |
| 263 | 293 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 264 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( | 294 "Event.Latency.ScrollBegin." + input_modality + |
| 265 "Event.Latency.ScrollBegin." + event_type_name + | |
| 266 ".TimeToScrollUpdateSwapBegin2", | 295 ".TimeToScrollUpdateSwapBegin2", |
| 267 original_component, gpu_swap_begin_component); | 296 original_component, gpu_swap_begin_component); |
| 268 | 297 |
| 269 // TODO(lanwei): Will remove them when M56 is stable, see | 298 // TODO(lanwei): Will remove them when M56 is stable, see |
| 270 // https://crbug.com/669618. | 299 // https://crbug.com/669618. |
| 271 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( | 300 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 272 "Event.Latency.ScrollUpdate." + event_type_name + | 301 "Event.Latency.ScrollUpdate." + input_modality + |
| 273 ".TimeToFirstScrollUpdateSwapBegin2", | 302 ".TimeToFirstScrollUpdateSwapBegin2", |
| 274 original_component, gpu_swap_begin_component); | 303 original_component, gpu_swap_begin_component); |
| 275 } else if (latency.FindLatency( | 304 } else if (latency.FindLatency( |
| 276 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, | 305 ui::INPUT_EVENT_LATENCY_SCROLL_UPDATE_ORIGINAL_COMPONENT, |
| 277 latency_component_id, &original_component)) { | 306 latency_component_id, &original_component)) { |
| 278 // This UMA metric tracks the time from when the original touch event is | 307 // This UMA metric tracks the time from when the original touch event is |
| 279 // created to when the scroll gesture results in final frame swap. | 308 // created to when the scroll gesture results in final frame swap. |
| 280 // First scroll events are excluded from this metric. | 309 // First scroll events are excluded from this metric. |
| 281 if (event_type_name == "Touch") { | 310 if (input_modality == "Touch") { |
| 282 UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY( | 311 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 283 "Event.Latency.ScrollUpdate." + event_type_name + | 312 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", |
| 284 ".TimeToScrollUpdateSwapBegin2", | |
| 285 original_component, gpu_swap_begin_component); | 313 original_component, gpu_swap_begin_component); |
| 286 | 314 |
| 287 rappor::RapporService* rappor_service = | 315 rappor::RapporService* rappor_service = |
| 288 GetContentClient()->browser()->GetRapporService(); | 316 GetContentClient()->browser()->GetRapporService(); |
| 289 if (rappor_service && render_widget_host_delegate) { | 317 if (rappor_service && render_widget_host_delegate) { |
| 290 std::unique_ptr<rappor::Sample> sample = | 318 std::unique_ptr<rappor::Sample> sample = |
| 291 rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE); | 319 rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE); |
| 292 render_widget_host_delegate->AddDomainInfoToRapporSample(sample.get()); | 320 render_widget_host_delegate->AddDomainInfoToRapporSample(sample.get()); |
| 293 sample->SetUInt64Field("Latency", | 321 sample->SetUInt64Field("Latency", |
| 294 (gpu_swap_begin_component.last_event_time - | 322 (gpu_swap_begin_component.last_event_time - |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 312 if (!rendering_scheduled_on_main) { | 340 if (!rendering_scheduled_on_main) { |
| 313 if (!latency.FindLatency( | 341 if (!latency.FindLatency( |
| 314 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, | 342 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, |
| 315 &rendering_scheduled_component)) | 343 &rendering_scheduled_component)) |
| 316 return; | 344 return; |
| 317 } | 345 } |
| 318 | 346 |
| 319 const std::string thread_name = rendering_scheduled_on_main ? "Main" : "Impl"; | 347 const std::string thread_name = rendering_scheduled_on_main ? "Main" : "Impl"; |
| 320 | 348 |
| 321 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( | 349 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( |
| 322 "Event.Latency." + scroll_name + "." + event_type_name + | 350 "Event.Latency." + scroll_name + "." + input_modality + |
| 323 ".TimeToHandled2_" + thread_name, | 351 ".TimeToHandled2_" + thread_name, |
| 324 original_component, rendering_scheduled_component); | 352 original_component, rendering_scheduled_component); |
| 325 | 353 |
| 326 LatencyInfo::LatencyComponent renderer_swap_component; | 354 LatencyInfo::LatencyComponent renderer_swap_component; |
| 327 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, | 355 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 0, |
| 328 &renderer_swap_component)) | 356 &renderer_swap_component)) |
| 329 return; | 357 return; |
| 330 | 358 |
| 331 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( | 359 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( |
| 332 "Event.Latency." + scroll_name + "." + event_type_name + | 360 "Event.Latency." + scroll_name + "." + input_modality + |
| 333 ".HandledToRendererSwap2_" + thread_name, | 361 ".HandledToRendererSwap2_" + thread_name, |
| 334 rendering_scheduled_component, renderer_swap_component); | 362 rendering_scheduled_component, renderer_swap_component); |
| 335 | 363 |
| 336 LatencyInfo::LatencyComponent browser_received_swap_component; | 364 LatencyInfo::LatencyComponent browser_received_swap_component; |
| 337 if (!latency.FindLatency( | 365 if (!latency.FindLatency( |
| 338 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, | 366 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, |
| 339 &browser_received_swap_component)) | 367 &browser_received_swap_component)) |
| 340 return; | 368 return; |
| 341 | 369 |
| 342 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( | 370 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( |
| 343 "Event.Latency." + scroll_name + "." + event_type_name + | 371 "Event.Latency." + scroll_name + "." + input_modality + |
| 344 ".RendererSwapToBrowserNotified2", | 372 ".RendererSwapToBrowserNotified2", |
| 345 renderer_swap_component, browser_received_swap_component); | 373 renderer_swap_component, browser_received_swap_component); |
| 346 | 374 |
| 347 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( | 375 UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2( |
| 348 "Event.Latency." + scroll_name + "." + event_type_name + | 376 "Event.Latency." + scroll_name + "." + input_modality + |
| 349 ".BrowserNotifiedToBeforeGpuSwap2", | 377 ".BrowserNotifiedToBeforeGpuSwap2", |
| 350 browser_received_swap_component, gpu_swap_begin_component); | 378 browser_received_swap_component, gpu_swap_begin_component); |
| 351 | 379 |
| 352 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( | 380 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( |
| 353 "Event.Latency." + scroll_name + "." + event_type_name + ".GpuSwap2", | 381 "Event.Latency." + scroll_name + "." + input_modality + ".GpuSwap2", |
| 354 gpu_swap_begin_component, gpu_swap_end_component); | 382 gpu_swap_begin_component, gpu_swap_end_component); |
| 355 } | 383 } |
| 356 // LatencyComponents generated in the renderer must have component IDs | 384 // LatencyComponents generated in the renderer must have component IDs |
| 357 // provided to them by the browser process. This function adds the correct | 385 // provided to them by the browser process. This function adds the correct |
| 358 // component ID where necessary. | 386 // component ID where necessary. |
| 359 void AddLatencyInfoComponentIds(LatencyInfo* latency, | 387 void AddLatencyInfoComponentIds(LatencyInfo* latency, |
| 360 int64_t latency_component_id) { | 388 int64_t latency_component_id) { |
| 361 std::vector<std::pair<ui::LatencyComponentType, int64_t>> new_components_key; | 389 std::vector<std::pair<ui::LatencyComponentType, int64_t>> new_components_key; |
| 362 std::vector<LatencyInfo::LatencyComponent> new_components_value; | 390 std::vector<LatencyInfo::LatencyComponent> new_components_value; |
| 363 for (const auto& lc : latency->latency_components()) { | 391 for (const auto& lc : latency->latency_components()) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 DCHECK_EQ(0, latency_component_id_); | 431 DCHECK_EQ(0, latency_component_id_); |
| 404 last_event_id_ = static_cast<int64_t>(process_id) << 32; | 432 last_event_id_ = static_cast<int64_t>(process_id) << 32; |
| 405 latency_component_id_ = routing_id | last_event_id_; | 433 latency_component_id_ = routing_id | last_event_id_; |
| 406 } | 434 } |
| 407 | 435 |
| 408 void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( | 436 void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( |
| 409 WebInputEvent::Type type, | 437 WebInputEvent::Type type, |
| 410 int64_t latency_component_id, | 438 int64_t latency_component_id, |
| 411 const LatencyInfo& latency, | 439 const LatencyInfo& latency, |
| 412 InputEventAckState ack_result) { | 440 InputEventAckState ack_result) { |
| 413 if (latency.coalesced()) | 441 if (type != blink::WebInputEvent::MouseWheel && |
|
dtapuska
2016/12/15 14:54:49
Why are we adding back logging of coalesced events
tdresser
2016/12/15 15:26:37
I'll move this to another patch, update histogram
| |
| 442 !WebInputEvent::isTouchEventType(type)) { | |
| 414 return; | 443 return; |
| 444 } | |
| 415 | 445 |
| 416 LatencyInfo::LatencyComponent rwh_component; | 446 LatencyInfo::LatencyComponent rwh_component; |
| 417 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | 447 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |
| 418 latency_component_id, &rwh_component)) { | 448 latency_component_id, &rwh_component)) { |
| 419 return; | 449 return; |
| 420 } | 450 } |
| 421 DCHECK_EQ(rwh_component.event_count, 1u); | 451 DCHECK_EQ(rwh_component.event_count, 1u); |
| 422 | 452 |
| 423 LatencyInfo::LatencyComponent ui_component; | 453 LatencyInfo::LatencyComponent ui_component; |
| 424 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, | 454 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, |
| 425 &ui_component)) { | 455 &ui_component)) { |
| 426 DCHECK_EQ(ui_component.event_count, 1u); | 456 DCHECK_EQ(ui_component.event_count, 1u); |
| 427 base::TimeDelta ui_delta = | 457 base::TimeDelta ui_delta = |
| 428 rwh_component.event_time - ui_component.event_time; | 458 rwh_component.last_event_time - ui_component.first_event_time; |
| 429 | 459 |
| 430 if (type == blink::WebInputEvent::MouseWheel) { | 460 if (type == blink::WebInputEvent::MouseWheel) { |
| 431 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelUI", | 461 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelUI", |
| 432 ui_delta.InMicroseconds(), 1, 20000, 100); | 462 ui_delta.InMicroseconds(), 1, 20000, 100); |
| 433 | |
| 434 } else { | 463 } else { |
| 435 DCHECK(WebInputEvent::isTouchEventType(type)); | 464 DCHECK(WebInputEvent::isTouchEventType(type)); |
| 436 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchUI", | 465 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchUI", |
| 437 ui_delta.InMicroseconds(), 1, 20000, 100); | 466 ui_delta.InMicroseconds(), 1, 20000, 100); |
| 438 } | 467 } |
| 439 } | 468 } |
| 440 | 469 |
| 441 // Both tap and scroll gestures depend on the disposition of the touch start | 470 // Both tap and scroll gestures depend on the disposition of the touch start |
| 442 // and the current touch. For touch start, touch_start_default_prevented_ == | 471 // and the current touch. For touch start, touch_start_default_prevented_ == |
| 443 // (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED). | 472 // (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED). |
| 444 bool action_prevented = touch_start_default_prevented_ || | 473 bool action_prevented = touch_start_default_prevented_ || |
| 445 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | 474 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |
| 446 | 475 |
| 476 std::string event_name = WebInputEvent::GetName(type); | |
| 477 | |
| 478 std::string default_action_status = | |
| 479 action_prevented ? "DefaultPrevented" : "DefaultAllowed"; | |
| 480 | |
| 447 LatencyInfo::LatencyComponent main_component; | 481 LatencyInfo::LatencyComponent main_component; |
| 448 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, | 482 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, |
| 449 &main_component)) { | 483 &main_component)) { |
| 450 DCHECK_EQ(main_component.event_count, 1u); | 484 DCHECK_EQ(main_component.event_count, 1u); |
| 451 base::TimeDelta queueing_delta = | |
| 452 main_component.event_time - rwh_component.event_time; | |
| 453 | |
| 454 if (!multi_finger_gesture_) { | 485 if (!multi_finger_gesture_) { |
| 455 if (action_prevented) { | 486 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( |
| 456 switch (type) { | 487 "Event.Latency.QueueingTime." + event_name + default_action_status, |
| 457 case WebInputEvent::TouchStart: | 488 rwh_component, main_component); |
| 458 UMA_HISTOGRAM_TIMES( | |
| 459 "Event.Latency.QueueingTime.TouchStartDefaultPrevented", | |
| 460 queueing_delta); | |
| 461 break; | |
| 462 case WebInputEvent::TouchMove: | |
| 463 UMA_HISTOGRAM_TIMES( | |
| 464 "Event.Latency.QueueingTime.TouchMoveDefaultPrevented", | |
| 465 queueing_delta); | |
| 466 break; | |
| 467 case WebInputEvent::TouchEnd: | |
| 468 UMA_HISTOGRAM_TIMES( | |
| 469 "Event.Latency.QueueingTime.TouchEndDefaultPrevented", | |
| 470 queueing_delta); | |
| 471 break; | |
| 472 default: | |
| 473 break; | |
| 474 } | |
| 475 } else { | |
| 476 switch (type) { | |
| 477 case WebInputEvent::TouchStart: | |
| 478 UMA_HISTOGRAM_TIMES( | |
| 479 "Event.Latency.QueueingTime.TouchStartDefaultAllowed", | |
| 480 queueing_delta); | |
| 481 break; | |
| 482 case WebInputEvent::TouchMove: | |
| 483 UMA_HISTOGRAM_TIMES( | |
| 484 "Event.Latency.QueueingTime.TouchMoveDefaultAllowed", | |
| 485 queueing_delta); | |
| 486 break; | |
| 487 case WebInputEvent::TouchEnd: | |
| 488 UMA_HISTOGRAM_TIMES( | |
| 489 "Event.Latency.QueueingTime.TouchEndDefaultAllowed", | |
| 490 queueing_delta); | |
| 491 break; | |
| 492 default: | |
| 493 break; | |
| 494 } | |
| 495 } | |
| 496 } | 489 } |
| 497 } | 490 } |
| 498 | 491 |
| 499 LatencyInfo::LatencyComponent acked_component; | 492 LatencyInfo::LatencyComponent acked_component; |
| 500 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, | 493 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, |
| 501 &acked_component)) { | 494 &acked_component)) { |
| 502 DCHECK_EQ(acked_component.event_count, 1u); | 495 DCHECK_EQ(acked_component.event_count, 1u); |
| 503 base::TimeDelta acked_delta = | 496 if (!multi_finger_gesture_ && |
| 504 acked_component.event_time - rwh_component.event_time; | 497 main_component.event_time != base::TimeTicks()) { |
| 505 if (type == blink::WebInputEvent::MouseWheel) { | 498 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( |
| 506 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelAcked", | 499 "Event.Latency.BlockingTime." + event_name + default_action_status, |
| 507 acked_delta.InMicroseconds(), 1, 1000000, | 500 main_component, acked_component); |
| 508 100); | |
| 509 } else { | |
| 510 DCHECK(WebInputEvent::isTouchEventType(type)); | |
| 511 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchAcked", | |
| 512 acked_delta.InMicroseconds(), 1, 1000000, | |
| 513 100); | |
| 514 } | 501 } |
| 515 | 502 |
| 516 if (!multi_finger_gesture_ && | 503 std::string input_modality = WebInputEventTypeToInputModalityString(type); |
| 517 main_component.event_time != base::TimeTicks()) { | 504 if (input_modality != "") { |
| 518 base::TimeDelta blocking_delta; | 505 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 519 blocking_delta = acked_component.event_time - main_component.event_time; | 506 "Event.Latency.Browser." + input_modality + "Acked", rwh_component, |
| 520 | 507 acked_component); |
| 521 if (action_prevented) { | |
| 522 switch (type) { | |
| 523 case WebInputEvent::TouchStart: | |
| 524 UMA_HISTOGRAM_TIMES( | |
| 525 "Event.Latency.BlockingTime.TouchStartDefaultPrevented", | |
| 526 blocking_delta); | |
| 527 break; | |
| 528 case WebInputEvent::TouchMove: | |
| 529 UMA_HISTOGRAM_TIMES( | |
| 530 "Event.Latency.BlockingTime.TouchMoveDefaultPrevented", | |
| 531 blocking_delta); | |
| 532 break; | |
| 533 case WebInputEvent::TouchEnd: | |
| 534 UMA_HISTOGRAM_TIMES( | |
| 535 "Event.Latency.BlockingTime.TouchEndDefaultPrevented", | |
| 536 blocking_delta); | |
| 537 break; | |
| 538 default: | |
| 539 break; | |
| 540 } | |
| 541 } else { | |
| 542 switch (type) { | |
| 543 case WebInputEvent::TouchStart: | |
| 544 UMA_HISTOGRAM_TIMES( | |
| 545 "Event.Latency.BlockingTime.TouchStartDefaultAllowed", | |
| 546 blocking_delta); | |
| 547 break; | |
| 548 case WebInputEvent::TouchMove: | |
| 549 UMA_HISTOGRAM_TIMES( | |
| 550 "Event.Latency.BlockingTime.TouchMoveDefaultAllowed", | |
| 551 blocking_delta); | |
| 552 break; | |
| 553 case WebInputEvent::TouchEnd: | |
| 554 UMA_HISTOGRAM_TIMES( | |
| 555 "Event.Latency.BlockingTime.TouchEndDefaultAllowed", | |
| 556 blocking_delta); | |
| 557 break; | |
| 558 default: | |
| 559 break; | |
| 560 } | |
| 561 } | |
| 562 } | 508 } |
| 563 } | 509 } |
| 564 } | 510 } |
| 565 | 511 |
| 566 void RenderWidgetHostLatencyTracker::OnInputEvent( | 512 void RenderWidgetHostLatencyTracker::OnInputEvent( |
| 567 const blink::WebInputEvent& event, | 513 const blink::WebInputEvent& event, |
| 568 LatencyInfo* latency) { | 514 LatencyInfo* latency) { |
| 569 DCHECK(latency); | 515 DCHECK(latency); |
| 570 if (latency->FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | 516 if (latency->FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |
| 571 latency_component_id_, NULL)) { | 517 latency_component_id_, NULL)) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 const blink::WebInputEvent& event, | 571 const blink::WebInputEvent& event, |
| 626 LatencyInfo* latency, InputEventAckState ack_result) { | 572 LatencyInfo* latency, InputEventAckState ack_result) { |
| 627 DCHECK(latency); | 573 DCHECK(latency); |
| 628 | 574 |
| 629 // Latency ends when it is acked but does not cause render scheduling. | 575 // Latency ends when it is acked but does not cause render scheduling. |
| 630 bool rendering_scheduled = latency->FindLatency( | 576 bool rendering_scheduled = latency->FindLatency( |
| 631 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, nullptr); | 577 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, nullptr); |
| 632 rendering_scheduled |= latency->FindLatency( | 578 rendering_scheduled |= latency->FindLatency( |
| 633 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, nullptr); | 579 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, nullptr); |
| 634 | 580 |
| 635 if (WebInputEvent::isGestureEventType(event.type)) { | |
| 636 if (!rendering_scheduled) { | |
| 637 latency->AddLatencyNumber( | |
| 638 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0); | |
| 639 // TODO(jdduke): Consider exposing histograms for gesture event types. | |
| 640 } | |
| 641 return; | |
| 642 } | |
| 643 | |
| 644 if (WebInputEvent::isTouchEventType(event.type)) { | 581 if (WebInputEvent::isTouchEventType(event.type)) { |
| 645 const WebTouchEvent& touch_event = | 582 const WebTouchEvent& touch_event = |
| 646 *static_cast<const WebTouchEvent*>(&event); | 583 *static_cast<const WebTouchEvent*>(&event); |
| 647 if (event.type == WebInputEvent::TouchStart) { | 584 if (event.type == WebInputEvent::TouchStart) { |
| 648 DCHECK(touch_event.touchesLength >= 1); | 585 DCHECK(touch_event.touchesLength >= 1); |
| 649 multi_finger_gesture_ = touch_event.touchesLength != 1; | 586 multi_finger_gesture_ = touch_event.touchesLength != 1; |
| 650 touch_start_default_prevented_ = | 587 touch_start_default_prevented_ = |
| 651 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | 588 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |
| 652 } | 589 } |
| 653 | |
| 654 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); | |
| 655 | |
| 656 if (!rendering_scheduled) { | |
| 657 latency->AddLatencyNumber( | |
| 658 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | |
| 659 } | |
| 660 ComputeInputLatencyHistograms(event.type, latency_component_id_, *latency, | |
| 661 ack_result); | |
| 662 return; | |
| 663 } | 590 } |
| 664 | 591 |
| 665 if (event.type == WebInputEvent::MouseWheel) { | 592 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); |
| 666 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0); | 593 // If this event couldn't have caused a gesture event, and it didn't trigger |
| 667 if (!rendering_scheduled) { | 594 // rendering, we're done processing it. |
| 668 latency->AddLatencyNumber( | 595 if (!rendering_scheduled) { |
| 669 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_WHEEL_COMPONENT, 0, 0); | 596 latency->AddLatencyNumber(ui::INPUT_EVENT_LATENCY_TERMINATED_COMPONENT, 0, |
| 670 } | 597 0); |
| 671 ComputeInputLatencyHistograms(event.type, latency_component_id_, *latency, | |
| 672 ack_result); | |
| 673 return; | |
| 674 } | 598 } |
| 675 | 599 ComputeInputLatencyHistograms(event.type, latency_component_id_, *latency, |
| 676 if (WebInputEvent::isMouseEventType(event.type) && !rendering_scheduled) { | 600 ack_result); |
| 677 latency->AddLatencyNumber( | |
| 678 ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0); | |
| 679 return; | |
| 680 } | |
| 681 | |
| 682 if (WebInputEvent::isKeyboardEventType(event.type) && !rendering_scheduled) { | |
| 683 latency->AddLatencyNumber( | |
| 684 ui::INPUT_EVENT_LATENCY_TERMINATED_KEYBOARD_COMPONENT, 0, 0); | |
| 685 return; | |
| 686 } | |
| 687 } | 601 } |
| 688 | 602 |
| 689 void RenderWidgetHostLatencyTracker::OnSwapCompositorFrame( | 603 void RenderWidgetHostLatencyTracker::OnSwapCompositorFrame( |
| 690 std::vector<LatencyInfo>* latencies) { | 604 std::vector<LatencyInfo>* latencies) { |
| 691 DCHECK(latencies); | 605 DCHECK(latencies); |
| 692 for (LatencyInfo& latency : *latencies) { | 606 for (LatencyInfo& latency : *latencies) { |
| 693 AddLatencyInfoComponentIds(&latency, latency_component_id_); | 607 AddLatencyInfoComponentIds(&latency, latency_component_id_); |
| 694 latency.AddLatencyNumber( | 608 latency.AddLatencyNumber( |
| 695 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0); | 609 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 0, 0); |
| 696 } | 610 } |
| 697 } | 611 } |
| 698 | 612 |
| 699 void RenderWidgetHostLatencyTracker::OnFrameSwapped( | 613 void RenderWidgetHostLatencyTracker::OnFrameSwapped( |
| 700 const LatencyInfo& latency, | 614 const LatencyInfo& latency, |
| 701 bool is_running_navigation_hint_task) { | 615 bool is_running_navigation_hint_task) { |
| 702 | |
| 703 LatencyInfo::LatencyComponent gpu_swap_end_component; | 616 LatencyInfo::LatencyComponent gpu_swap_end_component; |
| 704 if (!latency.FindLatency( | 617 if (!latency.FindLatency( |
| 705 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, | 618 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, |
| 706 &gpu_swap_end_component)) { | 619 &gpu_swap_end_component)) { |
| 707 return; | 620 return; |
| 708 } | 621 } |
| 709 | 622 |
| 710 LatencyInfo::LatencyComponent gpu_swap_begin_component; | 623 LatencyInfo::LatencyComponent gpu_swap_begin_component; |
| 711 if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, | 624 if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, |
| 712 &gpu_swap_begin_component)) { | 625 &gpu_swap_begin_component)) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 726 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | 639 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |
| 727 latency_component_id_, nullptr)) { | 640 latency_component_id_, nullptr)) { |
| 728 return; | 641 return; |
| 729 } | 642 } |
| 730 | 643 |
| 731 ui::SourceEventType source_event_type = latency.source_event_type(); | 644 ui::SourceEventType source_event_type = latency.source_event_type(); |
| 732 if (source_event_type == ui::SourceEventType::WHEEL || | 645 if (source_event_type == ui::SourceEventType::WHEEL || |
| 733 source_event_type == ui::SourceEventType::TOUCH) { | 646 source_event_type == ui::SourceEventType::TOUCH) { |
| 734 ComputeTouchAndWheelScrollLatencyHistograms( | 647 ComputeTouchAndWheelScrollLatencyHistograms( |
| 735 render_widget_host_delegate_, gpu_swap_begin_component, | 648 render_widget_host_delegate_, gpu_swap_begin_component, |
| 736 gpu_swap_end_component, latency_component_id_, latency, | 649 gpu_swap_end_component, latency_component_id_, latency); |
| 737 source_event_type == ui::SourceEventType::WHEEL ? "Wheel" : "Touch"); | |
| 738 } | 650 } |
| 739 | 651 |
| 740 // Compute the old scroll update latency metrics. They are exclusively | 652 // Compute the old scroll update latency metrics. They are exclusively |
| 741 // calculated for touch scrolls, and will be deprecated on M56. | 653 // calculated for touch scrolls, and will be deprecated on M56. |
| 742 // (https://crbug.com/649754) | 654 // (https://crbug.com/649754) |
| 743 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component; | 655 LatencyInfo::LatencyComponent mouse_wheel_scroll_update_component; |
| 744 if (!latency.FindLatency( | 656 if (!latency.FindLatency( |
| 745 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, | 657 ui::INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 0, |
| 746 &mouse_wheel_scroll_update_component)) { | 658 &mouse_wheel_scroll_update_component)) { |
| 747 ComputeScrollLatencyHistograms( | 659 ComputeScrollLatencyHistograms( |
| 748 gpu_swap_begin_component, gpu_swap_end_component, latency_component_id_, | 660 gpu_swap_begin_component, gpu_swap_end_component, latency_component_id_, |
| 749 latency, is_running_navigation_hint_task); | 661 latency, is_running_navigation_hint_task); |
| 750 } | 662 } |
| 751 } | 663 } |
| 752 | 664 |
| 753 void RenderWidgetHostLatencyTracker::SetDelegate( | 665 void RenderWidgetHostLatencyTracker::SetDelegate( |
| 754 RenderWidgetHostDelegate* delegate) { | 666 RenderWidgetHostDelegate* delegate) { |
| 755 render_widget_host_delegate_ = delegate; | 667 render_widget_host_delegate_ = delegate; |
| 756 } | 668 } |
| 757 | 669 |
| 758 } // namespace content | 670 } // namespace content |
| OLD | NEW |