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 #ifndef CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_ | 5 #ifndef CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_ |
6 #define CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_ | 6 #define CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_ |
7 | 7 |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 | 9 |
10 // STATIC_HISTOGRAM_POINTER_BLOCK only calls histogram_factory_get_invocation | 10 // STATIC_HISTOGRAM_POINTER_BLOCK only calls histogram_factory_get_invocation |
11 // at the first time and uses the cached histogram_pointer for subsequent calls | 11 // at the first time and uses the cached histogram_pointer for subsequent calls |
12 // through base::subtle::Release_Store() and base::subtle::Acquire_Load(). | 12 // through base::subtle::Release_Store() and base::subtle::Acquire_Load(). |
13 // If the histogram name changes between subsequent calls, use this non-cached | 13 // If the histogram name changes between subsequent calls, use this non-cached |
14 // version that always calls histogram_factory_get_invocation. | 14 // version that always calls histogram_factory_get_invocation. |
15 #define STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE( \ | 15 #define STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE( \ |
16 constant_histogram_name, \ | 16 constant_histogram_name, histogram_add_method_invocation, \ |
17 histogram_add_method_invocation, \ | 17 histogram_factory_get_invocation) \ |
18 histogram_factory_get_invocation) \ | 18 do { \ |
19 do { \ | |
20 base::HistogramBase* histogram_pointer = histogram_factory_get_invocation; \ | 19 base::HistogramBase* histogram_pointer = histogram_factory_get_invocation; \ |
21 if (DCHECK_IS_ON) \ | 20 if (DCHECK_IS_ON()) \ |
22 histogram_pointer->CheckName(constant_histogram_name); \ | 21 histogram_pointer->CheckName(constant_histogram_name); \ |
23 histogram_pointer->histogram_add_method_invocation; \ | 22 histogram_pointer->histogram_add_method_invocation; \ |
24 } while (0) | 23 } while (0) |
25 | 24 |
26 #define UMA_HISTOGRAM_CUSTOM_TIMES_NO_CACHE( \ | 25 #define UMA_HISTOGRAM_CUSTOM_TIMES_NO_CACHE( \ |
27 name, sample, min, max, bucket_count) \ | 26 name, sample, min, max, bucket_count) \ |
28 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, AddTime(sample), \ | 27 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, AddTime(sample), \ |
29 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ | 28 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ |
30 base::Histogram::kUmaTargetedHistogramFlag)) | 29 base::Histogram::kUmaTargetedHistogramFlag)) |
31 | 30 |
32 #define UMA_HISTOGRAM_CUSTOM_COUNTS_NO_CACHE(name, sample, min, max, \ | 31 #define UMA_HISTOGRAM_CUSTOM_COUNTS_NO_CACHE(name, sample, min, max, \ |
33 bucket_count) \ | 32 bucket_count) \ |
34 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, Add(sample), \ | 33 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, Add(sample), \ |
35 base::Histogram::FactoryGet(name, min, max, bucket_count, \ | 34 base::Histogram::FactoryGet(name, min, max, bucket_count, \ |
36 base::HistogramBase::kUmaTargetedHistogramFlag)) | 35 base::HistogramBase::kUmaTargetedHistogramFlag)) |
37 | 36 |
38 #define UMA_HISTOGRAM_ENUMERATION_NO_CACHE(name, sample, boundary_value) \ | 37 #define UMA_HISTOGRAM_ENUMERATION_NO_CACHE(name, sample, boundary_value) \ |
39 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, Add(sample), \ | 38 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, Add(sample), \ |
40 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ | 39 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ |
41 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag)) | 40 boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag)) |
42 | 41 |
43 #define UMA_HISTOGRAM_ENUMERATION_COUNT_NO_CACHE(name, sample, count, \ | 42 #define UMA_HISTOGRAM_ENUMERATION_COUNT_NO_CACHE(name, sample, count, \ |
44 boundary_value) \ | 43 boundary_value) \ |
45 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, AddCount(sample, count), \ | 44 STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, AddCount(sample, count), \ |
46 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ | 45 base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ |
47 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag)) | 46 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag)) |
48 | 47 |
49 #endif // CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_ | 48 #endif // CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_ |
OLD | NEW |