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

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

Issue 921473003: Break down end-to-end scroll update latency UMA metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 10 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/render_widget_host_latency_tracker.h" 5 #include "content/browser/renderer_host/render_widget_host_latency_tracker.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // This UMA metric tracks the time from when the original touch event is 164 // This UMA metric tracks the time from when the original touch event is
165 // created (averaged if there are multiple) to when the scroll gesture 165 // created (averaged if there are multiple) to when the scroll gesture
166 // results in final frame swap. 166 // results in final frame swap.
167 for (size_t i = 0; i < original_component.event_count; i++) { 167 for (size_t i = 0; i < original_component.event_count; i++) {
168 UMA_HISTOGRAM_CUSTOM_COUNTS( 168 UMA_HISTOGRAM_CUSTOM_COUNTS(
169 "Event.Latency.TouchToScrollUpdateSwap", 169 "Event.Latency.TouchToScrollUpdateSwap",
170 (swap_component.event_time - original_component.event_time) 170 (swap_component.event_time - original_component.event_time)
171 .InMicroseconds(), 171 .InMicroseconds(),
172 1, 1000000, 100); 172 1, 1000000, 100);
173 } 173 }
174
175 LatencyInfo::LatencyComponent rendering_scheduled_component;
176 bool rendering_scheduled_on_main = latency.FindLatency(
177 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT,
178 0, &rendering_scheduled_component);
179
180 if (!rendering_scheduled_on_main) {
181 if (!latency.FindLatency(
182 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT,
183 0, &rendering_scheduled_component))
184 return;
185 }
186
187 UMA_HISTOGRAM_CUSTOM_COUNTS(
188 rendering_scheduled_on_main ?
Alexei Svitkine (slow) 2015/02/12 15:31:32 This is not valid to do. Histogram macros cache t
Yufeng Shen (Slow to review) 2015/02/12 21:33:25 Thanks for pointing this out.
189 "Event.Latency.ScrollUpdateTouchToHandledMain" :
190 "Event.Latency.ScrollUpdateTouchToHandledImpl",
191 (rendering_scheduled_component.event_time -
192 original_component.event_time).InMicroseconds(),
193 1, 1000000, 100);
194
195 LatencyInfo::LatencyComponent renderer_swap_component;
196 if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
197 0, &renderer_swap_component))
198 return;
199
200 UMA_HISTOGRAM_CUSTOM_COUNTS(
201 rendering_scheduled_on_main ?
202 "Event.Latency.ScrollUpdateHandledMainToRendererSwap" :
203 "Event.Latency.ScrollUpdateHandledImplToRendererSwap",
204 (renderer_swap_component.event_time -
205 rendering_scheduled_component.event_time).
206 InMicroseconds(),
207 1, 1000000, 100);
208
209 LatencyInfo::LatencyComponent browser_received_swap_component;
210 if (!latency.FindLatency(
211 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT,
212 0, &browser_received_swap_component))
213 return;
214
215 UMA_HISTOGRAM_CUSTOM_COUNTS(
216 "Event.Latency.ScrollUpdateRendererSwapToBrowserNotified",
217 (browser_received_swap_component.event_time -
218 renderer_swap_component.event_time).InMicroseconds(),
219 1, 1000000, 100);
220
221 LatencyInfo::LatencyComponent gpu_swap_component;
222 if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT,
223 0, &gpu_swap_component))
224 return;
225
226 UMA_HISTOGRAM_CUSTOM_COUNTS(
227 "Event.Latency.ScrollUpdateBrowserNotifiedToBeforeGpuSwap",
228 (gpu_swap_component.event_time -
229 browser_received_swap_component.event_time).InMicroseconds(),
230 1, 1000000, 100);
Alexei Svitkine (slow) 2015/02/12 15:31:33 If you're using the same ranges for all of these,
Yufeng Shen (Slow to review) 2015/02/12 21:33:25 Done.
231
232 UMA_HISTOGRAM_CUSTOM_COUNTS(
233 "Event.Latency.ScrollUpdateGpuSwap",
234 (swap_component.event_time -
235 gpu_swap_component.event_time).InMicroseconds(),
236 1, 1000000, 100);
174 } 237 }
175 238
176 // LatencyComponents generated in the renderer must have component IDs 239 // LatencyComponents generated in the renderer must have component IDs
177 // provided to them by the browser process. This function adds the correct 240 // provided to them by the browser process. This function adds the correct
178 // component ID where necessary. 241 // component ID where necessary.
179 void AddLatencyInfoComponentIds(LatencyInfo* latency, 242 void AddLatencyInfoComponentIds(LatencyInfo* latency,
180 int64 latency_component_id) { 243 int64 latency_component_id) {
181 LatencyInfo::LatencyMap new_components; 244 LatencyInfo::LatencyMap new_components;
182 auto lc = latency->latency_components.begin(); 245 auto lc = latency->latency_components.begin();
183 while (lc != latency->latency_components.end()) { 246 while (lc != latency->latency_components.end()) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 320 }
258 } 321 }
259 322
260 void RenderWidgetHostLatencyTracker::OnInputEventAck( 323 void RenderWidgetHostLatencyTracker::OnInputEventAck(
261 const blink::WebInputEvent& event, 324 const blink::WebInputEvent& event,
262 LatencyInfo* latency) { 325 LatencyInfo* latency) {
263 DCHECK(latency); 326 DCHECK(latency);
264 327
265 // Latency ends when it is acked but does not cause render scheduling. 328 // Latency ends when it is acked but does not cause render scheduling.
266 bool rendering_scheduled = latency->FindLatency( 329 bool rendering_scheduled = latency->FindLatency(
267 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL); 330 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, nullptr);
331 rendering_scheduled |= latency->FindLatency(
332 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, nullptr);
268 333
269 if (WebInputEvent::isGestureEventType(event.type)) { 334 if (WebInputEvent::isGestureEventType(event.type)) {
270 if (!rendering_scheduled) { 335 if (!rendering_scheduled) {
271 latency->AddLatencyNumber( 336 latency->AddLatencyNumber(
272 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0); 337 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0);
273 // TODO(jdduke): Consider exposing histograms for gesture event types. 338 // TODO(jdduke): Consider exposing histograms for gesture event types.
274 } 339 }
275 return; 340 return;
276 } 341 }
277 342
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // cause regressions. 426 // cause regressions.
362 return std::max( 427 return std::max(
363 browser_composite_latency_history_.Percentile( 428 browser_composite_latency_history_.Percentile(
364 kBrowserCompositeLatencyEstimationPercentile) * 429 kBrowserCompositeLatencyEstimationPercentile) *
365 kBrowserCompositeLatencyEstimationSlack, 430 kBrowserCompositeLatencyEstimationSlack,
366 base::TimeDelta::FromMicroseconds( 431 base::TimeDelta::FromMicroseconds(
367 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60))); 432 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)));
368 } 433 }
369 434
370 } // namespace content 435 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698