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

Unified Diff: content/renderer/render_widget.cc

Issue 16213002: Add telemetry to track the time an event spent waiting for the main thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 6 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 | « content/renderer/gpu/input_event_filter.cc ('k') | tools/perf/measurements/smoothness.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index bb06cfe956eaafc0f7e210d0a5f394ea25c9ea6a..c31b4c4bbb9fc1f27b0087760272174d7c0e90d2 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -139,6 +139,55 @@ const char* GetEventName(WebInputEvent::Type type) {
#undef CASE_TYPE
return "";
}
+
+void SendToImplThreadLatencyUma(int routing_id,
+ const ui::LatencyInfo& latency_info,
+ WebInputEvent::Type event_type) {
+ ui::LatencyInfo::LatencyComponent dispatch_component;
+ ui::LatencyInfo::LatencyComponent receive_component;
+ if (latency_info.FindLatency(
+ ui::INPUT_EVENT_LATENCY_SENT_FROM_IMPL_THREAD_COMPONENT,
+ routing_id, &dispatch_component) &&
+ latency_info.FindLatency(
+ ui::INPUT_EVENT_LATENCY_RECEIVED_ON_MAIN_THREAD_COMPONENT,
+ routing_id, &receive_component)) {
+ base::TimeDelta delta = receive_component.event_time -
+ dispatch_component.event_time;
+ switch (event_type) {
+ case WebInputEvent::GestureScrollBegin:
+ case WebInputEvent::GestureScrollUpdate:
+ case WebInputEvent::GestureScrollUpdateWithoutPropagation:
+ UMA_HISTOGRAM_TIMES(
+ "Event.Latency.ImplThreadToRendererThread.GestureScroll", delta);
+ break;
+ case WebInputEvent::TouchStart:
+ case WebInputEvent::TouchMove:
+ UMA_HISTOGRAM_TIMES(
+ "Event.Latency.ImplThreadToRendererThread.Touch", delta);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void UpdateRenderingStatsForAverageImplThreadLatency(
+ int routing_id,
+ const ui::LatencyInfo& latency_info,
+ cc::RenderingStats& stats) {
+ ui::LatencyInfo::LatencyComponent dispatch_component;
+ ui::LatencyInfo::LatencyComponent receive_component;
+ if (latency_info.FindLatency(
+ ui::INPUT_EVENT_LATENCY_SENT_FROM_IMPL_THREAD_COMPONENT,
+ routing_id, &dispatch_component) &&
+ latency_info.FindLatency(
+ ui::INPUT_EVENT_LATENCY_RECEIVED_ON_MAIN_THREAD_COMPONENT,
+ routing_id, &receive_component)) {
+ stats.average_impl_thread_to_main_thread_time =
+ receive_component.event_time - dispatch_component.event_time;
jbauman 2013/07/03 20:00:15 This won't calculate an average. You'd need to sum
varunjain 2013/07/04 16:49:46 Done.
+ }
+}
+
}
namespace content {
@@ -738,6 +787,9 @@ void RenderWidget::OnHandleInputEvent(const WebKit::WebInputEvent* input_event,
compositor_->SetLatencyInfo(latency_info);
else
latency_info_.MergeWith(latency_info);
+ SendToImplThreadLatencyUma(routing_id(), latency_info, input_event->type);
+ UpdateRenderingStatsForAverageImplThreadLatency(routing_id(), latency_info_,
jbauman 2013/07/03 20:00:15 You probably don't want to use latency_info_ here.
varunjain 2013/07/04 16:49:46 Done.
+ software_stats_);
base::TimeDelta now = base::TimeDelta::FromInternalValue(
base::TimeTicks::Now().ToInternalValue());
@@ -2333,6 +2385,8 @@ void RenderWidget::GetRenderingStats(
software_stats_.total_paint_time;
stats.rendering_stats.total_pixels_painted +=
software_stats_.total_pixels_painted;
+ stats.rendering_stats.average_impl_thread_to_main_thread_time =
+ software_stats_.average_impl_thread_to_main_thread_time;
}
bool RenderWidget::GetGpuRenderingStats(GpuRenderingStats* stats) const {
« no previous file with comments | « content/renderer/gpu/input_event_filter.cc ('k') | tools/perf/measurements/smoothness.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698