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

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: 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 typedef std::pair<LatencyInfo::LatencyComponent, bool> ComponentPair;
176
177 ComponentPair rendering_scheduled_main_component;
178 ComponentPair rendering_scheduled_impl_component;
179 ComponentPair renderer_swap_component;
jdduke (slow) 2015/02/11 23:22:02 Do these always go together? If not, can we early
Yufeng Shen (Slow to review) 2015/02/12 02:59:02 CHECK seems too restrict here. I will just do earl
180 ComponentPair browser_received_swap_component;
181 ComponentPair gpu_swap_component;
182
183 rendering_scheduled_main_component.second =
184 latency.FindLatency(
185 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT,
186 0, &(rendering_scheduled_main_component.first));
187
188 rendering_scheduled_impl_component.second =
189 latency.FindLatency(
190 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT,
191 0, &(rendering_scheduled_impl_component.first));
192
193 renderer_swap_component.second =
194 latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
195 0, &(renderer_swap_component.first));
196
197 browser_received_swap_component.second =
198 latency.FindLatency(
199 ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT,
200 0, &(browser_received_swap_component.first));
201
202 gpu_swap_component.second =
203 latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT,
204 0, &(gpu_swap_component.first));
205
206 if (rendering_scheduled_main_component.second) {
207 UMA_HISTOGRAM_CUSTOM_COUNTS(
208 "Event.Latency.ScrollUpdateTouchToHandledMain",
209 (rendering_scheduled_main_component.first.event_time -
210 original_component.event_time).InMicroseconds(),
211 1, 1000000, 100);
212 }
213
214 if (rendering_scheduled_impl_component.second) {
215 UMA_HISTOGRAM_CUSTOM_COUNTS(
216 "Event.Latency.ScrollUpdateTouchToHandledImpl",
217 (rendering_scheduled_impl_component.first.event_time -
218 original_component.event_time).InMicroseconds(),
219 1, 1000000, 100);
220 }
221
222 if (renderer_swap_component.second) {
223 if (rendering_scheduled_main_component.second) {
224 UMA_HISTOGRAM_CUSTOM_COUNTS(
225 "Event.Latency.ScrollUpdateHandledMainToRendererSwap",
226 (renderer_swap_component.first.event_time -
227 rendering_scheduled_main_component.first.event_time).
228 InMicroseconds(),
229 1, 1000000, 100);
230 }
231
232 if (rendering_scheduled_impl_component.second) {
233 UMA_HISTOGRAM_CUSTOM_COUNTS(
234 "Event.Latency.ScrollUpdateHandledImplToRendererSwap",
235 (renderer_swap_component.first.event_time -
236 rendering_scheduled_impl_component.first.event_time).
237 InMicroseconds(),
238 1, 1000000, 100);
239 }
240
241 if (browser_received_swap_component.second) {
242 UMA_HISTOGRAM_CUSTOM_COUNTS(
243 "Event.Latency.ScrollUpdateRendererSwapToBrowserNotified",
244 (browser_received_swap_component.first.event_time -
245 renderer_swap_component.first.event_time).InMicroseconds(),
246 1, 1000000, 100);
247 }
248 }
249
250 if (gpu_swap_component.second) {
251 if (browser_received_swap_component.second) {
252 UMA_HISTOGRAM_CUSTOM_COUNTS(
253 "Event.Latency.ScrollUpdateBrowserNotifiedToBeforeGpuSwap",
254 (gpu_swap_component.first.event_time -
255 browser_received_swap_component.first.event_time).InMicroseconds(),
256 1, 1000000, 100);
257 }
258
259 UMA_HISTOGRAM_CUSTOM_COUNTS(
260 "Event.Latency.ScrollUpdateGpuSwap",
261 (swap_component.event_time -
262 gpu_swap_component.first.event_time).InMicroseconds(),
263 1, 1000000, 100);
264 }
174 } 265 }
175 266
176 // LatencyComponents generated in the renderer must have component IDs 267 // LatencyComponents generated in the renderer must have component IDs
177 // provided to them by the browser process. This function adds the correct 268 // provided to them by the browser process. This function adds the correct
178 // component ID where necessary. 269 // component ID where necessary.
179 void AddLatencyInfoComponentIds(LatencyInfo* latency, 270 void AddLatencyInfoComponentIds(LatencyInfo* latency,
180 int64 latency_component_id) { 271 int64 latency_component_id) {
181 LatencyInfo::LatencyMap new_components; 272 LatencyInfo::LatencyMap new_components;
182 auto lc = latency->latency_components.begin(); 273 auto lc = latency->latency_components.begin();
183 while (lc != latency->latency_components.end()) { 274 while (lc != latency->latency_components.end()) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 348 }
258 } 349 }
259 350
260 void RenderWidgetHostLatencyTracker::OnInputEventAck( 351 void RenderWidgetHostLatencyTracker::OnInputEventAck(
261 const blink::WebInputEvent& event, 352 const blink::WebInputEvent& event,
262 LatencyInfo* latency) { 353 LatencyInfo* latency) {
263 DCHECK(latency); 354 DCHECK(latency);
264 355
265 // Latency ends when it is acked but does not cause render scheduling. 356 // Latency ends when it is acked but does not cause render scheduling.
266 bool rendering_scheduled = latency->FindLatency( 357 bool rendering_scheduled = latency->FindLatency(
267 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL); 358 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, nullptr);
359 rendering_scheduled |= latency->FindLatency(
360 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, nullptr);
268 361
269 if (WebInputEvent::isGestureEventType(event.type)) { 362 if (WebInputEvent::isGestureEventType(event.type)) {
270 if (!rendering_scheduled) { 363 if (!rendering_scheduled) {
271 latency->AddLatencyNumber( 364 latency->AddLatencyNumber(
272 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0); 365 ui::INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT, 0, 0);
273 // TODO(jdduke): Consider exposing histograms for gesture event types. 366 // TODO(jdduke): Consider exposing histograms for gesture event types.
274 } 367 }
275 return; 368 return;
276 } 369 }
277 370
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // cause regressions. 454 // cause regressions.
362 return std::max( 455 return std::max(
363 browser_composite_latency_history_.Percentile( 456 browser_composite_latency_history_.Percentile(
364 kBrowserCompositeLatencyEstimationPercentile) * 457 kBrowserCompositeLatencyEstimationPercentile) *
365 kBrowserCompositeLatencyEstimationSlack, 458 kBrowserCompositeLatencyEstimationSlack,
366 base::TimeDelta::FromMicroseconds( 459 base::TimeDelta::FromMicroseconds(
367 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60))); 460 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)));
368 } 461 }
369 462
370 } // namespace content 463 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698