OLD | NEW |
1 // | 1 // |
2 // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 // | 3 // |
4 // Use of this source code is governed by a BSD-style license | 4 // Use of this source code is governed by a BSD-style license |
5 // that can be found in the LICENSE file in the root of the source | 5 // that can be found in the LICENSE file in the root of the source |
6 // tree. An additional intellectual property rights grant can be found | 6 // tree. An additional intellectual property rights grant can be found |
7 // in the file PATENTS. All contributing project authors may | 7 // in the file PATENTS. All contributing project authors may |
8 // be found in the AUTHORS file in the root of the source tree. | 8 // be found in the AUTHORS file in the root of the source tree. |
9 // | 9 // |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 #define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ | 80 #define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ |
81 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ | 81 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ |
82 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) | 82 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) |
83 | 83 |
84 // Deprecated. | 84 // Deprecated. |
85 // TODO(asapersson): Remove. | 85 // TODO(asapersson): Remove. |
86 #define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \ | 86 #define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \ |
87 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100, 50) | 87 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100, 50) |
88 | 88 |
89 #define RTC_HISTOGRAM_COUNTS_SPARSE_200(name, sample) \ | |
90 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 200, 50) | |
91 | |
92 #define RTC_HISTOGRAM_COUNTS_SPARSE_1000(name, sample) \ | |
93 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 1000, 50) | |
94 | |
95 #define RTC_HISTOGRAM_COUNTS_SPARSE_10000(name, sample) \ | |
96 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 10000, 50) | |
97 | |
98 #define RTC_HISTOGRAM_COUNTS_SPARSE_100000(name, sample) \ | |
99 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100000, 50) | |
100 | |
101 #define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \ | 89 #define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \ |
102 RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \ | 90 RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \ |
103 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) | 91 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) |
104 | 92 |
105 // Histogram for percentage (evenly spaced buckets). | 93 // Histogram for percentage (evenly spaced buckets). |
106 #define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ | 94 #define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ |
107 RTC_HISTOGRAM_ENUMERATION(name, sample, 101) | 95 RTC_HISTOGRAM_ENUMERATION(name, sample, 101) |
108 | 96 |
109 // Deprecated. | |
110 // TODO(asapersson): Remove. | |
111 #define RTC_HISTOGRAM_PERCENTAGE_SPARSE(name, sample) \ | |
112 RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, 101) | |
113 | |
114 // Histogram for enumerators (evenly spaced buckets). | 97 // Histogram for enumerators (evenly spaced buckets). |
115 // |boundary| should be above the max enumerator sample. | 98 // |boundary| should be above the max enumerator sample. |
116 #define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ | 99 #define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ |
117 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ | 100 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ |
118 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) | 101 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) |
119 | 102 |
120 // Deprecated. | |
121 // TODO(asapersson): Remove. | |
122 #define RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, boundary) \ | |
123 RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \ | |
124 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) | |
125 | |
126 // The name of the histogram should not vary. | 103 // The name of the histogram should not vary. |
127 // TODO(asapersson): Consider changing string to const char*. | 104 // TODO(asapersson): Consider changing string to const char*. |
128 #define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \ | 105 #define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \ |
129 factory_get_invocation) \ | 106 factory_get_invocation) \ |
130 do { \ | 107 do { \ |
131 static webrtc::metrics::Histogram* atomic_histogram_pointer = nullptr; \ | 108 static webrtc::metrics::Histogram* atomic_histogram_pointer = nullptr; \ |
132 webrtc::metrics::Histogram* histogram_pointer = \ | 109 webrtc::metrics::Histogram* histogram_pointer = \ |
133 rtc::AtomicOps::AcquireLoadPtr(&atomic_histogram_pointer); \ | 110 rtc::AtomicOps::AcquireLoadPtr(&atomic_histogram_pointer); \ |
134 if (!histogram_pointer) { \ | 111 if (!histogram_pointer) { \ |
135 histogram_pointer = factory_get_invocation; \ | 112 histogram_pointer = factory_get_invocation; \ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Function for adding a |sample| to a histogram. | 203 // Function for adding a |sample| to a histogram. |
227 // |name| can be used to verify that it matches the histogram name. | 204 // |name| can be used to verify that it matches the histogram name. |
228 void HistogramAdd( | 205 void HistogramAdd( |
229 Histogram* histogram_pointer, const std::string& name, int sample); | 206 Histogram* histogram_pointer, const std::string& name, int sample); |
230 | 207 |
231 } // namespace metrics | 208 } // namespace metrics |
232 } // namespace webrtc | 209 } // namespace webrtc |
233 | 210 |
234 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ | 211 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ |
235 | 212 |
OLD | NEW |