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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 17757002: Add UMA/Telemetry stats for touch event latency (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index f37ec19ffa63c05d5d0d9437495f846648e3396b..9e848456b03d180fb7f86eb1c215d0814ea78641 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2565,6 +2565,96 @@ void RenderWidgetHostImpl::DetachDelegate() {
delegate_ = NULL;
}
+void RenderWidgetHostImpl::ComputeTouchLatency(
+ const ui::LatencyInfo& latency_info) {
+ typedef ui::LatencyInfo::LatencyMap::const_iterator LatencyIter;
+ const ui::LatencyInfo::LatencyMap& latency_map =
+ latency_info.latency_components;
+
+ LatencyIter original_it = latency_map.find(std::make_pair(
Rick Byers 2013/06/26 16:34:55 I think it would be a little cleaner to add a Late
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 Done.
+ ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0));
Rick Byers 2013/06/26 16:34:55 Are we guaranteed to have this (eg. for synthetic
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 Done.
+
+ LatencyIter ui_it = latency_map.find(std::make_pair(
jbauman 2013/06/26 08:52:53 Is it guaranteed that there will be at most one IN
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 This should be true. This function, ComputeTouchLa
+ ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0));
+
+ LatencyIter rwh_it = latency_map.find(std::make_pair(
+ ui::INPUT_EVENT_LATENCY_RWH_COMPONENT,
+ GetLatencyComponentId()));
+
+ LatencyIter acked_consumed_it = latency_map.find(std::make_pair(
+ ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT,
+ INPUT_EVENT_ACK_STATE_CONSUMED));
+
+ LatencyIter acked_not_consumed_it = latency_map.find(std::make_pair(
+ ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT,
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
+
+ LatencyIter acked_no_consumer_it = latency_map.find(std::make_pair(
+ ui::INPUT_EVENT_LATENCY_ACKED_COMPONENT,
+ INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS));
+
+ base::TimeDelta system_delta =
+ ui_it->second.event_time - original_it->second.event_time;
+ rendering_stats_.touch_system_count++;
+ rendering_stats_.total_touch_system_latency += system_delta;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Event.Latency.Touch.System",
jbauman 2013/06/26 08:52:53 This is kind of weird, because we're making a hist
Rick Byers 2013/06/26 16:34:55 Yeah, I'm very worried about relying on these aver
Rick Byers 2013/06/26 16:34:55 Isn't Event.Latency.Touch.System basically the sam
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 removed.
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 As comment above, there is no coalesce or latency
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 I think it is already taking the alternative appro
Rick Byers 2013/06/26 21:42:10 Ah, sorry - perfect, thanks!
+ system_delta.InMicroseconds(),
+ 0,
+ 20000,
+ 100);
+
+ base::TimeDelta ui_delta =
+ rwh_it->second.event_time - ui_it->second.event_time;
+ rendering_stats_.touch_ui_count++;
+ rendering_stats_.total_touch_ui_latency += ui_delta;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
Rick Byers 2013/06/26 16:34:55 It would be cleaner to use a common macro for all
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 As the reviewer for his CL points out that there i
+ "Event.Latency.Touch.UI",
+ ui_delta.InMicroseconds(),
+ 0,
+ 20000,
+ 100);
+
+ if (acked_consumed_it != latency_map.end()) {
+ base::TimeDelta acked_delta =
+ acked_consumed_it->second.event_time - rwh_it->second.event_time;
+ rendering_stats_.touch_acked_consumed_count++;
+ rendering_stats_.total_touch_acked_consumed_latency += acked_delta;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Event.Latency.Touch.Acked_Consumed",
+ acked_delta.InMicroseconds(),
+ 0,
+ 100000,
+ 100);
+ } else if (acked_not_consumed_it != latency_map.end()) {
+ base::TimeDelta acked_delta =
+ acked_not_consumed_it->second.event_time - rwh_it->second.event_time;
+ rendering_stats_.touch_acked_not_consumed_count++;
+ rendering_stats_.total_touch_acked_not_consumed_latency += acked_delta;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Event.Latency.Touch.Acked_Not_Consumed",
+ acked_delta.InMicroseconds(),
+ 0,
+ 100000,
+ 100);
+ } else if (acked_no_consumer_it != latency_map.end()) {
+ base::TimeDelta acked_delta =
+ acked_no_consumer_it->second.event_time - rwh_it->second.event_time;
+ rendering_stats_.touch_acked_no_consumer_count++;
+ rendering_stats_.total_touch_acked_no_consumer_latency += acked_delta;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Event.Latency.Touch.Acked_No_Consumer_Exists",
Rick Byers 2013/06/26 16:34:55 Separating out the metrics into the 3 ACK states i
Yufeng Shen (Slow to review) 2013/06/26 20:44:05 will do
+ acked_delta.InMicroseconds(),
+ 0,
+ 100000,
+ 100);
+ }
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableGpuBenchmarking))
+ Send(new ViewMsg_SetBrowserRenderingStats(routing_id_, rendering_stats_));
+}
+
void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) {
ui::LatencyInfo::LatencyMap::const_iterator l =
latency_info.latency_components.find(std::make_pair(

Powered by Google App Engine
This is Rietveld 408576698