| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 latency, device_scale_factor); | 75 latency, device_scale_factor); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Check valid timing for start and end latency components. | 79 // Check valid timing for start and end latency components. |
| 80 #define CONFIRM_VALID_TIMING(start, end) \ | 80 #define CONFIRM_VALID_TIMING(start, end) \ |
| 81 DCHECK(!start.first_event_time.is_null()); \ | 81 DCHECK(!start.first_event_time.is_null()); \ |
| 82 DCHECK(!end.last_event_time.is_null()); \ | 82 DCHECK(!end.last_event_time.is_null()); \ |
| 83 DCHECK_GE(end.last_event_time, start.first_event_time); | 83 DCHECK_GE(end.last_event_time, start.first_event_time); |
| 84 | 84 |
| 85 // Long scroll latency component that is mostly under 200ms. | |
| 86 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG(name, start, end) \ | |
| 87 CONFIRM_VALID_TIMING(start, end); \ | |
| 88 UMA_HISTOGRAM_CUSTOM_COUNTS( \ | |
| 89 name, (end.event_time - start.event_time).InMicroseconds(), 1000, \ | |
| 90 200000, 50) | |
| 91 | |
| 92 // Short scroll latency component that is mostly under 50ms. | |
| 93 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT(name, start, end) \ | |
| 94 CONFIRM_VALID_TIMING(start, end); \ | |
| 95 UMA_HISTOGRAM_CUSTOM_COUNTS( \ | |
| 96 name, (end.event_time - start.event_time).InMicroseconds(), 1, 50000, \ | |
| 97 50) | |
| 98 | |
| 99 // Event latency that is mostly under 1 second. We should only use 100 buckets | 85 // Event latency that is mostly under 1 second. We should only use 100 buckets |
| 100 // when needed. | 86 // when needed. |
| 101 #define UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(name, start, \ | 87 #define UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(name, start, \ |
| 102 end) \ | 88 end) \ |
| 103 CONFIRM_VALID_TIMING(start, end) \ | 89 CONFIRM_VALID_TIMING(start, end) \ |
| 104 base::UmaHistogramCustomCounts( \ | 90 base::UmaHistogramCustomCounts( \ |
| 105 name, (end.last_event_time - start.first_event_time).InMicroseconds(), \ | 91 name, (end.last_event_time - start.first_event_time).InMicroseconds(), \ |
| 106 1, 1000000, 100); | 92 1, 1000000, 100); |
| 107 | 93 |
| 108 #define UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(name, start, end) \ | 94 #define UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(name, start, end) \ |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 latency, is_running_navigation_hint_task); | 609 latency, is_running_navigation_hint_task); |
| 624 } | 610 } |
| 625 } | 611 } |
| 626 | 612 |
| 627 void RenderWidgetHostLatencyTracker::SetDelegate( | 613 void RenderWidgetHostLatencyTracker::SetDelegate( |
| 628 RenderWidgetHostDelegate* delegate) { | 614 RenderWidgetHostDelegate* delegate) { |
| 629 render_widget_host_delegate_ = delegate; | 615 render_widget_host_delegate_ = delegate; |
| 630 } | 616 } |
| 631 | 617 |
| 632 } // namespace content | 618 } // namespace content |
| OLD | NEW |