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

Side by Side Diff: content/renderer/input/render_widget_input_handler.cc

Issue 1907803002: Add metric to determine the benefit of forcing an event listener to be passive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_touch_scroll_intervention_uma
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/renderer/input/render_widget_input_handler.h" 5 #include "content/renderer/input/render_widget_input_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 default: 110 default:
111 // Must include default to let blink::WebInputEvent add new event types 111 // Must include default to let blink::WebInputEvent add new event types
112 // before they're added here. 112 // before they're added here.
113 DLOG(WARNING) << "Unhandled WebInputEvent type: " << event_type; 113 DLOG(WARNING) << "Unhandled WebInputEvent type: " << event_type;
114 break; 114 break;
115 } 115 }
116 116
117 #undef CASE_TYPE 117 #undef CASE_TYPE
118 } 118 }
119 119
120 void LogPassiveLatency(int64_t latency) {
121 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency", latency, 1,
122 10000000, 100);
123 }
124
125 void LogPassiveEventListenersUma(WebInputEventResult result, 120 void LogPassiveEventListenersUma(WebInputEventResult result,
126 WebInputEvent::DispatchType dispatch_type, 121 WebInputEvent::DispatchType dispatch_type,
127 double event_timestamp, 122 double event_timestamp,
128 const ui::LatencyInfo& latency_info) { 123 const ui::LatencyInfo& latency_info) {
129 enum { 124 enum {
130 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, 125 PASSIVE_LISTENER_UMA_ENUM_PASSIVE,
131 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, 126 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE,
132 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, 127 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED,
133 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, 128 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE,
134 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, 129 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED,
(...skipping 24 matching lines...) Expand all
159 NOTREACHED(); 154 NOTREACHED();
160 return; 155 return;
161 } 156 }
162 157
163 UMA_HISTOGRAM_ENUMERATION("Event.PassiveListeners", enum_value, 158 UMA_HISTOGRAM_ENUMERATION("Event.PassiveListeners", enum_value,
164 PASSIVE_LISTENER_UMA_ENUM_COUNT); 159 PASSIVE_LISTENER_UMA_ENUM_COUNT);
165 160
166 if (enum_value == PASSIVE_LISTENER_UMA_ENUM_CANCELABLE && 161 if (enum_value == PASSIVE_LISTENER_UMA_ENUM_CANCELABLE &&
167 base::TimeTicks::IsHighResolution()) { 162 base::TimeTicks::IsHighResolution()) {
168 base::TimeTicks now = base::TimeTicks::Now(); 163 base::TimeTicks now = base::TimeTicks::Now();
169 LogPassiveLatency(GetEventLatencyMicros(event_timestamp, now)); 164 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency",
165 GetEventLatencyMicros(event_timestamp, now), 1,
166 10000000, 100);
167 }
168
169 if (dispatch_type == WebInputEvent::ListenersForcedNonBlockingPassive) {
170 base::TimeTicks now = base::TimeTicks::Now();
tdresser 2016/04/21 13:36:42 Are you intentionally only recording the first one
dtapuska 2016/04/21 13:38:34 Err no; I meant to move this into a if(highRes) {
dtapuska 2016/04/21 20:46:38 Done.
171 UMA_HISTOGRAM_CUSTOM_COUNTS(
172 "Event.PassiveListeners.ForcedNonBlockingLatency",
173 GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
170 } 174 }
171 } 175 }
172 176
173 } // namespace 177 } // namespace
174 178
175 RenderWidgetInputHandler::RenderWidgetInputHandler( 179 RenderWidgetInputHandler::RenderWidgetInputHandler(
176 RenderWidgetInputHandlerDelegate* delegate, 180 RenderWidgetInputHandlerDelegate* delegate,
177 RenderWidget* widget) 181 RenderWidget* widget)
178 : delegate_(delegate), 182 : delegate_(delegate),
179 widget_(widget), 183 widget_(widget),
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 if (pending_input_event_ack_) { 546 if (pending_input_event_ack_) {
543 TRACE_EVENT_ASYNC_END0("input", 547 TRACE_EVENT_ASYNC_END0("input",
544 "RenderWidgetInputHandler::ThrottledInputEventAck", 548 "RenderWidgetInputHandler::ThrottledInputEventAck",
545 pending_input_event_ack_.get()); 549 pending_input_event_ack_.get());
546 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); 550 delegate_->OnInputEventAck(std::move(pending_input_event_ack_));
547 } 551 }
548 total_input_handling_time_this_frame_ = base::TimeDelta(); 552 total_input_handling_time_this_frame_ = base::TimeDelta();
549 } 553 }
550 554
551 } // namespace content 555 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698