| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ui/latency/latency_tracker.h" | 5 #include "ui/latency/latency_tracker.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_functions.h" | 7 #include "base/metrics/histogram_functions.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "ui/latency/latency_histogram_macros.h" | 9 #include "ui/latency/latency_histogram_macros.h" |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 void LatencyTracker::ReportRapporScrollLatency( | 115 void LatencyTracker::ReportRapporScrollLatency( |
| 116 const std::string& name, | 116 const std::string& name, |
| 117 const LatencyInfo::LatencyComponent& start_component, | 117 const LatencyInfo::LatencyComponent& start_component, |
| 118 const LatencyInfo::LatencyComponent& end_component) { | 118 const LatencyInfo::LatencyComponent& end_component) { |
| 119 // TODO(mfomitchev): crbug.com/717629: Make RAPPOR or UKM reporting work with | 119 // TODO(mfomitchev): crbug.com/717629: Make RAPPOR or UKM reporting work with |
| 120 // Mus. | 120 // Mus. |
| 121 } | 121 } |
| 122 | 122 |
| 123 void LatencyTracker::ReportUkmScrollLatency( |
| 124 const std::string& event_name, |
| 125 const std::string& metric_name, |
| 126 const LatencyInfo::LatencyComponent& start_component, |
| 127 const LatencyInfo::LatencyComponent& end_component) { |
| 128 // TODO(mfomitchev): crbug.com/717629: Make RAPPOR or UKM reporting work with |
| 129 // Mus. |
| 130 } |
| 131 |
| 123 void LatencyTracker::ComputeEndToEndLatencyHistograms( | 132 void LatencyTracker::ComputeEndToEndLatencyHistograms( |
| 124 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, | 133 const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, |
| 125 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, | 134 const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, |
| 126 const ui::LatencyInfo& latency) { | 135 const ui::LatencyInfo& latency) { |
| 127 DCHECK(!latency.coalesced()); | 136 DCHECK(!latency.coalesced()); |
| 128 if (latency.coalesced()) | 137 if (latency.coalesced()) |
| 129 return; | 138 return; |
| 130 | 139 |
| 131 LatencyInfo::LatencyComponent original_component; | 140 LatencyInfo::LatencyComponent original_component; |
| 132 std::string scroll_name = "ScrollUpdate"; | 141 std::string scroll_name = "ScrollUpdate"; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 163 // created to when the scroll gesture results in final frame swap. | 172 // created to when the scroll gesture results in final frame swap. |
| 164 // First scroll events are excluded from this metric. | 173 // First scroll events are excluded from this metric. |
| 165 if (input_modality == "Touch") { | 174 if (input_modality == "Touch") { |
| 166 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( | 175 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 167 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", | 176 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", |
| 168 original_component, gpu_swap_begin_component); | 177 original_component, gpu_swap_begin_component); |
| 169 | 178 |
| 170 ReportRapporScrollLatency( | 179 ReportRapporScrollLatency( |
| 171 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", | 180 "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", |
| 172 original_component, gpu_swap_begin_component); | 181 original_component, gpu_swap_begin_component); |
| 182 ReportUkmScrollLatency("Event.ScrollUpdate.Touch", |
| 183 "TimeToScrollUpdateSwapBegin", original_component, |
| 184 gpu_swap_begin_component); |
| 173 } | 185 } |
| 174 } else if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, | 186 } else if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, |
| 175 &original_component)) { | 187 &original_component)) { |
| 176 if (input_modality == "KeyPress") { | 188 if (input_modality == "KeyPress") { |
| 177 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( | 189 UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
| 178 "Event.Latency.EndToEnd.KeyPress", original_component, | 190 "Event.Latency.EndToEnd.KeyPress", original_component, |
| 179 gpu_swap_begin_component); | 191 gpu_swap_begin_component); |
| 180 } | 192 } |
| 181 } else { | 193 } else { |
| 182 // No original component found. | 194 // No original component found. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 "Event.Latency." + scroll_name + "." + input_modality + | 237 "Event.Latency." + scroll_name + "." + input_modality + |
| 226 ".BrowserNotifiedToBeforeGpuSwap2", | 238 ".BrowserNotifiedToBeforeGpuSwap2", |
| 227 browser_received_swap_component, gpu_swap_begin_component); | 239 browser_received_swap_component, gpu_swap_begin_component); |
| 228 | 240 |
| 229 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( | 241 UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2( |
| 230 "Event.Latency." + scroll_name + "." + input_modality + ".GpuSwap2", | 242 "Event.Latency." + scroll_name + "." + input_modality + ".GpuSwap2", |
| 231 gpu_swap_begin_component, gpu_swap_end_component); | 243 gpu_swap_begin_component, gpu_swap_end_component); |
| 232 } | 244 } |
| 233 | 245 |
| 234 } // namespace ui | 246 } // namespace ui |
| OLD | NEW |