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

Side by Side Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker.cc

Issue 2954473002: Record accuracy of expected queueing time metric. (Closed)
Patch Set: Fix include. Created 3 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 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/input/render_widget_host_latency_tracker .h" 5 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_functions.h" 10 #include "base/metrics/histogram_functions.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 for (size_t i = 0; i < new_components_key.size(); i++) { 67 for (size_t i = 0; i < new_components_key.size(); i++) {
68 latency->AddLatencyNumberWithTimestamp( 68 latency->AddLatencyNumberWithTimestamp(
69 new_components_key[i].first, 69 new_components_key[i].first,
70 new_components_key[i].second, 70 new_components_key[i].second,
71 new_components_value[i].sequence_number, 71 new_components_value[i].sequence_number,
72 new_components_value[i].event_time, 72 new_components_value[i].event_time,
73 new_components_value[i].event_count); 73 new_components_value[i].event_count);
74 } 74 }
75 } 75 }
76 76
77 void RecordEQTAccuracy(base::TimeDelta queueing_time,
78 base::TimeDelta expected_queueing_time) {
79 float expected_queueing_time_ms = expected_queueing_time.InMillisecondsF();
80
81 if (expected_queueing_time_ms < 10) {
82 UMA_HISTOGRAM_TIMES(
83 "RendererScheduler."
84 "QueueingDurationWhenExpectedQueueingTime.LessThan.10ms",
85 queueing_time);
86 }
87
88 if (expected_queueing_time_ms < 150) {
89 UMA_HISTOGRAM_TIMES(
90 "RendererScheduler."
91 "QueueingDurationWhenExpectedQueueingTime.LessThan.150ms",
92 queueing_time);
93 }
94
95 if (expected_queueing_time_ms < 300) {
96 UMA_HISTOGRAM_TIMES(
97 "RendererScheduler."
98 "QueueingDurationWhenExpectedQueueingTime.LessThan.300ms",
99 queueing_time);
100 }
101
102 if (expected_queueing_time_ms < 450) {
103 UMA_HISTOGRAM_TIMES(
104 "RendererScheduler."
105 "QueueingDurationWhenExpectedQueueingTime.LessThan.450ms",
106 queueing_time);
107 }
108
109 if (expected_queueing_time_ms > 10) {
110 UMA_HISTOGRAM_TIMES(
111 "RendererScheduler."
112 "QueueingDurationWhenExpectedQueueingTime.GreaterThan.10ms",
113 queueing_time);
114 }
115
116 if (expected_queueing_time_ms > 150) {
117 UMA_HISTOGRAM_TIMES(
118 "RendererScheduler."
119 "QueueingDurationWhenExpectedQueueingTime.GreaterThan.150ms",
120 queueing_time);
121 }
122
123 if (expected_queueing_time_ms > 300) {
124 UMA_HISTOGRAM_TIMES(
125 "RendererScheduler."
126 "QueueingDurationWhenExpectedQueueingTime.GreaterThan.300ms",
127 queueing_time);
128 }
129
130 if (expected_queueing_time_ms > 450) {
131 UMA_HISTOGRAM_TIMES(
132 "RendererScheduler."
133 "QueueingDurationWhenExpectedQueueingTime.GreaterThan.450ms",
134 queueing_time);
135 }
136 }
137
77 } // namespace 138 } // namespace
78 139
79 RenderWidgetHostLatencyTracker::RenderWidgetHostLatencyTracker() 140 RenderWidgetHostLatencyTracker::RenderWidgetHostLatencyTracker()
80 : ukm_source_id_(-1), 141 : ukm_source_id_(-1),
81 last_event_id_(0), 142 last_event_id_(0),
82 latency_component_id_(0), 143 latency_component_id_(0),
83 device_scale_factor_(1), 144 device_scale_factor_(1),
84 has_seen_first_gesture_scroll_update_(false), 145 has_seen_first_gesture_scroll_update_(false),
85 active_multi_finger_gesture_(false), 146 active_multi_finger_gesture_(false),
86 touch_start_default_prevented_(false), 147 touch_start_default_prevented_(false),
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 action_prevented ? "DefaultPrevented" : "DefaultAllowed"; 220 action_prevented ? "DefaultPrevented" : "DefaultAllowed";
160 221
161 LatencyInfo::LatencyComponent main_component; 222 LatencyInfo::LatencyComponent main_component;
162 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, 223 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0,
163 &main_component)) { 224 &main_component)) {
164 DCHECK_EQ(main_component.event_count, 1u); 225 DCHECK_EQ(main_component.event_count, 1u);
165 if (!multi_finger_touch_gesture) { 226 if (!multi_finger_touch_gesture) {
166 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( 227 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
167 "Event.Latency.QueueingTime." + event_name + default_action_status, 228 "Event.Latency.QueueingTime." + event_name + default_action_status,
168 rwh_component, main_component); 229 rwh_component, main_component);
230
231 RecordEQTAccuracy(
232 main_component.last_event_time - rwh_component.first_event_time,
233 latency.expected_queueing_time_on_dispatch());
169 } 234 }
170 } 235 }
171 236
172 LatencyInfo::LatencyComponent acked_component; 237 LatencyInfo::LatencyComponent acked_component;
173 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 238 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0,
174 &acked_component)) { 239 &acked_component)) {
175 DCHECK_EQ(acked_component.event_count, 1u); 240 DCHECK_EQ(acked_component.event_count, 1u);
176 if (!multi_finger_touch_gesture && 241 if (!multi_finger_touch_gesture &&
177 main_component.event_time != base::TimeTicks()) { 242 main_component.event_time != base::TimeTicks()) {
178 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( 243 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (ukm_source_id == -1 || !ukm_recorder) 415 if (ukm_source_id == -1 || !ukm_recorder)
351 return; 416 return;
352 417
353 std::unique_ptr<ukm::UkmEntryBuilder> builder = 418 std::unique_ptr<ukm::UkmEntryBuilder> builder =
354 ukm_recorder->GetEntryBuilder(ukm_source_id, event_name.c_str()); 419 ukm_recorder->GetEntryBuilder(ukm_source_id, event_name.c_str());
355 builder->AddMetric(metric_name.c_str(), (end_component.last_event_time - 420 builder->AddMetric(metric_name.c_str(), (end_component.last_event_time -
356 start_component.first_event_time) 421 start_component.first_event_time)
357 .InMicroseconds()); 422 .InMicroseconds());
358 } 423 }
359 } // namespace content 424 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698