| OLD | NEW |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 for (size_t i = 0; i < new_components_key.size(); i++) { | 68 for (size_t i = 0; i < new_components_key.size(); i++) { |
| 69 latency->AddLatencyNumberWithTimestamp( | 69 latency->AddLatencyNumberWithTimestamp( |
| 70 new_components_key[i].first, | 70 new_components_key[i].first, |
| 71 new_components_key[i].second, | 71 new_components_key[i].second, |
| 72 new_components_value[i].sequence_number, | 72 new_components_value[i].sequence_number, |
| 73 new_components_value[i].event_time, | 73 new_components_value[i].event_time, |
| 74 new_components_value[i].event_count); | 74 new_components_value[i].event_count); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 void RecordEQTAccuracy(base::TimeDelta queueing_time, |
| 79 base::TimeDelta expected_queueing_time) { |
| 80 float expected_queueing_time_ms = expected_queueing_time.InMillisecondsF(); |
| 81 |
| 82 if (expected_queueing_time_ms < 10) { |
| 83 UMA_HISTOGRAM_TIMES( |
| 84 "RendererScheduler." |
| 85 "QueueingDurationWhenExpectedQueueingTime_LessThan.10ms", |
| 86 queueing_time); |
| 87 } |
| 88 |
| 89 if (expected_queueing_time_ms < 150) { |
| 90 UMA_HISTOGRAM_TIMES( |
| 91 "RendererScheduler." |
| 92 "QueueingDurationWhenExpectedQueueingTime_LessThan.150ms", |
| 93 queueing_time); |
| 94 } |
| 95 |
| 96 if (expected_queueing_time_ms < 300) { |
| 97 UMA_HISTOGRAM_TIMES( |
| 98 "RendererScheduler." |
| 99 "QueueingDurationWhenExpectedQueueingTime_LessThan.300ms", |
| 100 queueing_time); |
| 101 } |
| 102 |
| 103 if (expected_queueing_time_ms < 450) { |
| 104 UMA_HISTOGRAM_TIMES( |
| 105 "RendererScheduler." |
| 106 "QueueingDurationWhenExpectedQueueingTime_LessThan.450ms", |
| 107 queueing_time); |
| 108 } |
| 109 |
| 110 if (expected_queueing_time_ms > 10) { |
| 111 UMA_HISTOGRAM_TIMES( |
| 112 "RendererScheduler." |
| 113 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.10ms", |
| 114 queueing_time); |
| 115 } |
| 116 |
| 117 if (expected_queueing_time_ms > 150) { |
| 118 UMA_HISTOGRAM_TIMES( |
| 119 "RendererScheduler." |
| 120 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.150ms", |
| 121 queueing_time); |
| 122 } |
| 123 |
| 124 if (expected_queueing_time_ms > 300) { |
| 125 UMA_HISTOGRAM_TIMES( |
| 126 "RendererScheduler." |
| 127 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.300ms", |
| 128 queueing_time); |
| 129 } |
| 130 |
| 131 if (expected_queueing_time_ms > 450) { |
| 132 UMA_HISTOGRAM_TIMES( |
| 133 "RendererScheduler." |
| 134 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.450ms", |
| 135 queueing_time); |
| 136 } |
| 137 } |
| 138 |
| 78 } // namespace | 139 } // namespace |
| 79 | 140 |
| 80 RenderWidgetHostLatencyTracker::RenderWidgetHostLatencyTracker() | 141 RenderWidgetHostLatencyTracker::RenderWidgetHostLatencyTracker() |
| 81 : ukm_source_id_(-1), | 142 : ukm_source_id_(-1), |
| 82 last_event_id_(0), | 143 last_event_id_(0), |
| 83 latency_component_id_(0), | 144 latency_component_id_(0), |
| 84 device_scale_factor_(1), | 145 device_scale_factor_(1), |
| 85 has_seen_first_gesture_scroll_update_(false), | 146 has_seen_first_gesture_scroll_update_(false), |
| 86 active_multi_finger_gesture_(false), | 147 active_multi_finger_gesture_(false), |
| 87 touch_start_default_prevented_(false), | 148 touch_start_default_prevented_(false), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 action_prevented ? "DefaultPrevented" : "DefaultAllowed"; | 221 action_prevented ? "DefaultPrevented" : "DefaultAllowed"; |
| 161 | 222 |
| 162 LatencyInfo::LatencyComponent main_component; | 223 LatencyInfo::LatencyComponent main_component; |
| 163 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, | 224 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, |
| 164 &main_component)) { | 225 &main_component)) { |
| 165 DCHECK_EQ(main_component.event_count, 1u); | 226 DCHECK_EQ(main_component.event_count, 1u); |
| 166 if (!multi_finger_touch_gesture) { | 227 if (!multi_finger_touch_gesture) { |
| 167 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( | 228 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( |
| 168 "Event.Latency.QueueingTime." + event_name + default_action_status, | 229 "Event.Latency.QueueingTime." + event_name + default_action_status, |
| 169 rwh_component, main_component); | 230 rwh_component, main_component); |
| 231 |
| 232 RecordEQTAccuracy( |
| 233 main_component.last_event_time - rwh_component.first_event_time, |
| 234 latency.expected_queueing_time_on_dispatch()); |
| 170 } | 235 } |
| 171 } | 236 } |
| 172 | 237 |
| 173 LatencyInfo::LatencyComponent acked_component; | 238 LatencyInfo::LatencyComponent acked_component; |
| 174 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, | 239 if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, |
| 175 &acked_component)) { | 240 &acked_component)) { |
| 176 DCHECK_EQ(acked_component.event_count, 1u); | 241 DCHECK_EQ(acked_component.event_count, 1u); |
| 177 if (!multi_finger_touch_gesture && | 242 if (!multi_finger_touch_gesture && |
| 178 main_component.event_time != base::TimeTicks()) { | 243 main_component.event_time != base::TimeTicks()) { |
| 179 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( | 244 UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS( |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 if (ukm_source_id == -1 || !ukm_recorder) | 420 if (ukm_source_id == -1 || !ukm_recorder) |
| 356 return; | 421 return; |
| 357 | 422 |
| 358 std::unique_ptr<ukm::UkmEntryBuilder> builder = | 423 std::unique_ptr<ukm::UkmEntryBuilder> builder = |
| 359 ukm_recorder->GetEntryBuilder(ukm_source_id, event_name.c_str()); | 424 ukm_recorder->GetEntryBuilder(ukm_source_id, event_name.c_str()); |
| 360 builder->AddMetric(metric_name.c_str(), (end_component.last_event_time - | 425 builder->AddMetric(metric_name.c_str(), (end_component.last_event_time - |
| 361 start_component.first_event_time) | 426 start_component.first_event_time) |
| 362 .InMicroseconds()); | 427 .InMicroseconds()); |
| 363 } | 428 } |
| 364 } // namespace content | 429 } // namespace content |
| OLD | NEW |