OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_LATENCY_LATENCY_HISTOGRAM_MACROS_H_ |
| 6 #define UI_LATENCY_LATENCY_HISTOGRAM_MACROS_H_ |
| 7 |
| 8 #include "base/metrics/histogram_functions.h" |
| 9 |
| 10 // Check valid timing for start and end latency components. |
| 11 #define CONFIRM_VALID_TIMING(start, end) \ |
| 12 DCHECK(!start.first_event_time.is_null()); \ |
| 13 DCHECK(!end.last_event_time.is_null()); \ |
| 14 DCHECK_GE(end.last_event_time, start.first_event_time); |
| 15 |
| 16 // Event latency that is mostly under 1 second. We should only use 100 buckets |
| 17 // when needed. |
| 18 #define UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS(name, start, \ |
| 19 end) \ |
| 20 CONFIRM_VALID_TIMING(start, end) \ |
| 21 base::UmaHistogramCustomCounts( \ |
| 22 name, (end.last_event_time - start.first_event_time).InMicroseconds(), \ |
| 23 1, 1000000, 100); |
| 24 |
| 25 #define UMA_HISTOGRAM_INPUT_LATENCY_MILLISECONDS(name, start, end) \ |
| 26 CONFIRM_VALID_TIMING(start, end) \ |
| 27 base::UmaHistogramCustomCounts( \ |
| 28 name, (end.last_event_time - start.first_event_time).InMilliseconds(), \ |
| 29 1, 1000, 50); |
| 30 |
| 31 // Long touch/wheel scroll latency component that is mostly under 200ms. |
| 32 #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG_2(name, start, end) \ |
| 33 CONFIRM_VALID_TIMING(start, end) \ |
| 34 base::Histogram::FactoryGet(name, 1000, 200000, 50, \ |
| 35 base::HistogramBase::kUmaTargetedHistogramFlag) \ |
| 36 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); |
| 37 |
| 38 // Short touch/wheel scroll latency component that is mostly under 50ms. |
| 39 #define UMA_HISTOGRAM_SCROLL_LATENCY_SHORT_2(name, start, end) \ |
| 40 CONFIRM_VALID_TIMING(start, end) \ |
| 41 base::Histogram::FactoryGet(name, 1, 50000, 50, \ |
| 42 base::HistogramBase::kUmaTargetedHistogramFlag) \ |
| 43 ->Add((end.last_event_time - start.first_event_time).InMicroseconds()); |
| 44 |
| 45 #endif // UI_LATENCY_LATENCY_HISTOGRAM_MACROS_H_ |
OLD | NEW |