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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_latency_tracker.cc
diff --git a/content/browser/renderer_host/render_widget_host_latency_tracker.cc b/content/browser/renderer_host/render_widget_host_latency_tracker.cc
index 2d738c491910c4d429709da26d4ecd6193f9105b..a4bb02131838b0614a4250adfc0225edc5c67978 100644
--- a/content/browser/renderer_host/render_widget_host_latency_tracker.cc
+++ b/content/browser/renderer_host/render_widget_host_latency_tracker.cc
@@ -135,6 +135,13 @@ void ComputeInputLatencyHistograms(WebInputEvent::Type type,
}
}
+// Scroll latency is mostly under 1000ms.
+#define UMA_HISTOGRAM_SCROLL_LATENCY(name, end, start) \
jdduke (slow) 2015/02/12 21:44:08 The end vs start arg order is a little confusing w
Yufeng Shen (Slow to review) 2015/02/12 22:04:56 Done.
+ UMA_HISTOGRAM_CUSTOM_COUNTS( \
+ name, \
+ (end.event_time - start.event_time).InMicroseconds(), \
+ 1, 1000000, 100)
+
void ComputeScrollLatencyHistograms(
const LatencyInfo::LatencyComponent& swap_component,
int64 latency_component_id,
@@ -148,11 +155,9 @@ void ComputeScrollLatencyHistograms(
// first scroll event in a sequence and the original timestamp of that
// scroll event's underlying touch event.
for (size_t i = 0; i < first_original_component.event_count; i++) {
- UMA_HISTOGRAM_CUSTOM_COUNTS(
+ UMA_HISTOGRAM_SCROLL_LATENCY(
"Event.Latency.TouchToFirstScrollUpdateSwap",
- (swap_component.event_time - first_original_component.event_time)
- .InMicroseconds(),
- 1, 1000000, 100);
+ swap_component, first_original_component);
}
original_component = first_original_component;
} else if (!latency.FindLatency(
@@ -165,12 +170,69 @@ void ComputeScrollLatencyHistograms(
// created (averaged if there are multiple) to when the scroll gesture
// results in final frame swap.
for (size_t i = 0; i < original_component.event_count; i++) {
- UMA_HISTOGRAM_CUSTOM_COUNTS(
+ UMA_HISTOGRAM_SCROLL_LATENCY(
"Event.Latency.TouchToScrollUpdateSwap",
- (swap_component.event_time - original_component.event_time)
- .InMicroseconds(),
- 1, 1000000, 100);
+ swap_component, original_component);
+ }
+
+ LatencyInfo::LatencyComponent rendering_scheduled_component;
+ bool rendering_scheduled_on_main = latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT,
+ 0, &rendering_scheduled_component);
+
+ if (!rendering_scheduled_on_main) {
+ if (!latency.FindLatency(
+ ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT,
+ 0, &rendering_scheduled_component))
+ return;
+ }
+
+ if (rendering_scheduled_on_main) {
+ UMA_HISTOGRAM_SCROLL_LATENCY(
+ "Event.Latency.ScrollUpdate.TouchToHandled_Main",
+ rendering_scheduled_component, original_component);
+ } else {
+ UMA_HISTOGRAM_SCROLL_LATENCY(
+ "Event.Latency.ScrollUpdate.TouchToHandled_Impl",
+ rendering_scheduled_component, original_component);
+ }
+
+ LatencyInfo::LatencyComponent renderer_swap_component;
+ if (!latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
+ 0, &renderer_swap_component))
+ return;
+
+ if (rendering_scheduled_on_main) {
+ UMA_HISTOGRAM_SCROLL_LATENCY(
+ "Event.Latency.ScrollUpdate.HandledToRendererSwap_Main",
+ renderer_swap_component, rendering_scheduled_component);
+ } else {
+ UMA_HISTOGRAM_SCROLL_LATENCY(
+ "Event.Latency.ScrollUpdate.HandledToRendererSwap_Impl",
+ renderer_swap_component, rendering_scheduled_component);
}
+
+ LatencyInfo::LatencyComponent browser_received_swap_component;
+ if (!latency.FindLatency(
+ ui::INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT,
+ 0, &browser_received_swap_component))
+ return;
+
+ UMA_HISTOGRAM_SCROLL_LATENCY(
+ "Event.Latency.ScrollUpdate.RendererSwapToBrowserNotified",
+ browser_received_swap_component, renderer_swap_component);
+
+ LatencyInfo::LatencyComponent gpu_swap_component;
+ if (!latency.FindLatency(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT,
+ 0, &gpu_swap_component))
+ return;
+
+ UMA_HISTOGRAM_SCROLL_LATENCY(
+ "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap",
+ gpu_swap_component, browser_received_swap_component);
+
+ UMA_HISTOGRAM_SCROLL_LATENCY("Event.Latency.ScrollUpdate.GpuSwap",
+ swap_component, gpu_swap_component);
}
// LatencyComponents generated in the renderer must have component IDs
@@ -264,7 +326,9 @@ void RenderWidgetHostLatencyTracker::OnInputEventAck(
// Latency ends when it is acked but does not cause render scheduling.
bool rendering_scheduled = latency->FindLatency(
- ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL);
+ ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_MAIN_COMPONENT, 0, nullptr);
+ rendering_scheduled |= latency->FindLatency(
+ ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_IMPL_COMPONENT, 0, nullptr);
if (WebInputEvent::isGestureEventType(event.type)) {
if (!rendering_scheduled) {
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698