Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Side by Side Diff: webrtc/system_wrappers/include/metrics.h

Issue 2326843003: Remove RTC_LOGGED_* macro. (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/video_coding/timing.cc ('k') | webrtc/video/call_stats.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #define RTC_HISTOGRAM_COUNTS_1000(name, sample) \ 75 #define RTC_HISTOGRAM_COUNTS_1000(name, sample) \
76 RTC_HISTOGRAM_COUNTS(name, sample, 1, 1000, 50) 76 RTC_HISTOGRAM_COUNTS(name, sample, 1, 1000, 50)
77 77
78 #define RTC_HISTOGRAM_COUNTS_10000(name, sample) \ 78 #define RTC_HISTOGRAM_COUNTS_10000(name, sample) \
79 RTC_HISTOGRAM_COUNTS(name, sample, 1, 10000, 50) 79 RTC_HISTOGRAM_COUNTS(name, sample, 1, 10000, 50)
80 80
81 #define RTC_HISTOGRAM_COUNTS_100000(name, sample) \ 81 #define RTC_HISTOGRAM_COUNTS_100000(name, sample) \
82 RTC_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50) 82 RTC_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50)
83 83
84 #define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ 84 #define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \
85 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, false, \ 85 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \
86 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count))
87
88 // RTC_HISTOGRAM_COUNTS with logging.
89 #define RTC_LOGGED_HISTOGRAM_COUNTS_100(name, sample) \
90 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100, 50)
91
92 #define RTC_LOGGED_HISTOGRAM_COUNTS_200(name, sample) \
93 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 200, 50)
94
95 #define RTC_LOGGED_HISTOGRAM_COUNTS_500(name, sample) \
96 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 500, 50)
97
98 #define RTC_LOGGED_HISTOGRAM_COUNTS_1000(name, sample) \
99 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 1000, 50)
100
101 #define RTC_LOGGED_HISTOGRAM_COUNTS_10000(name, sample) \
102 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 10000, 50)
103
104 #define RTC_LOGGED_HISTOGRAM_COUNTS_100000(name, sample) \
105 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50)
106
107 #define RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \
108 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, true, \
109 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) 86 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count))
110 87
111 // Deprecated. 88 // Deprecated.
112 // TODO(asapersson): Remove. 89 // TODO(asapersson): Remove.
113 #define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \ 90 #define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \
114 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100, 50) 91 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100, 50)
115 92
116 #define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \ 93 #define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \
117 RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \ 94 RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \
118 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) 95 webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count))
119 96
120 // Histogram for percentage (evenly spaced buckets). 97 // Histogram for percentage (evenly spaced buckets).
121 #define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ 98 #define RTC_HISTOGRAM_PERCENTAGE(name, sample) \
122 RTC_HISTOGRAM_ENUMERATION(name, sample, 101) 99 RTC_HISTOGRAM_ENUMERATION(name, sample, 101)
123 100
124 // RTC_HISTOGRAM_PERCENTAGE with logging.
125 #define RTC_LOGGED_HISTOGRAM_PERCENTAGE(name, sample) \
126 RTC_LOGGED_HISTOGRAM_ENUMERATION(name, sample, 101)
127
128 // Histogram for booleans. 101 // Histogram for booleans.
129 #define RTC_HISTOGRAM_BOOLEAN(name, sample) \ 102 #define RTC_HISTOGRAM_BOOLEAN(name, sample) \
130 RTC_HISTOGRAM_ENUMERATION(name, sample, 2) 103 RTC_HISTOGRAM_ENUMERATION(name, sample, 2)
131 104
132 // RTC_HISTOGRAM_BOOLEAN with logging.
133 #define RTC_LOGGED_HISTOGRAM_BOOLEAN(name, sample) \
134 RTC_LOGGED_HISTOGRAM_ENUMERATION(name, sample, 2)
135
136 // Histogram for enumerators (evenly spaced buckets). 105 // Histogram for enumerators (evenly spaced buckets).
137 // |boundary| should be above the max enumerator sample. 106 // |boundary| should be above the max enumerator sample.
138 #define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ 107 #define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \
139 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, false, \ 108 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \
140 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary))
141
142 // RTC_HISTOGRAM_ENUMERATION with logging.
143 #define RTC_LOGGED_HISTOGRAM_ENUMERATION(name, sample, boundary) \
144 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, true, \
145 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) 109 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary))
146 110
147 // The name of the histogram should not vary. 111 // The name of the histogram should not vary.
148 // TODO(asapersson): Consider changing string to const char*. 112 // TODO(asapersson): Consider changing string to const char*.
149 #define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, log, \ 113 #define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \
150 factory_get_invocation) \ 114 factory_get_invocation) \
151 do { \ 115 do { \
152 if (log) { \
153 LOG(LS_INFO) << constant_name << " " << sample; \
154 } \
155 static webrtc::metrics::Histogram* atomic_histogram_pointer = nullptr; \ 116 static webrtc::metrics::Histogram* atomic_histogram_pointer = nullptr; \
156 webrtc::metrics::Histogram* histogram_pointer = \ 117 webrtc::metrics::Histogram* histogram_pointer = \
157 rtc::AtomicOps::AcquireLoadPtr(&atomic_histogram_pointer); \ 118 rtc::AtomicOps::AcquireLoadPtr(&atomic_histogram_pointer); \
158 if (!histogram_pointer) { \ 119 if (!histogram_pointer) { \
159 histogram_pointer = factory_get_invocation; \ 120 histogram_pointer = factory_get_invocation; \
160 webrtc::metrics::Histogram* prev_pointer = \ 121 webrtc::metrics::Histogram* prev_pointer = \
161 rtc::AtomicOps::CompareAndSwapPtr( \ 122 rtc::AtomicOps::CompareAndSwapPtr( \
162 &atomic_histogram_pointer, \ 123 &atomic_histogram_pointer, \
163 static_cast<webrtc::metrics::Histogram*>(nullptr), \ 124 static_cast<webrtc::metrics::Histogram*>(nullptr), \
164 histogram_pointer); \ 125 histogram_pointer); \
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 RTC_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50)) 167 RTC_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50))
207 168
208 #define RTC_HISTOGRAMS_ENUMERATION(index, name, sample, boundary) \ 169 #define RTC_HISTOGRAMS_ENUMERATION(index, name, sample, boundary) \
209 RTC_HISTOGRAMS_COMMON(index, name, sample, \ 170 RTC_HISTOGRAMS_COMMON(index, name, sample, \
210 RTC_HISTOGRAM_ENUMERATION(name, sample, boundary)) 171 RTC_HISTOGRAM_ENUMERATION(name, sample, boundary))
211 172
212 #define RTC_HISTOGRAMS_PERCENTAGE(index, name, sample) \ 173 #define RTC_HISTOGRAMS_PERCENTAGE(index, name, sample) \
213 RTC_HISTOGRAMS_COMMON(index, name, sample, \ 174 RTC_HISTOGRAMS_COMMON(index, name, sample, \
214 RTC_HISTOGRAM_PERCENTAGE(name, sample)) 175 RTC_HISTOGRAM_PERCENTAGE(name, sample))
215 176
216 // RTC_HISTOGRAMS_COUNTS with logging.
217 #define RTC_LOGGED_HISTOGRAMS_COUNTS_100(index, name, sample) \
218 RTC_HISTOGRAMS_COMMON(index, name, sample, \
219 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100, 50))
220
221 #define RTC_LOGGED_HISTOGRAMS_COUNTS_200(index, name, sample) \
222 RTC_HISTOGRAMS_COMMON(index, name, sample, \
223 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 200, 50))
224
225 #define RTC_LOGGED_HISTOGRAMS_COUNTS_500(index, name, sample) \
226 RTC_HISTOGRAMS_COMMON(index, name, sample, \
227 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 500, 50))
228
229 #define RTC_LOGGED_HISTOGRAMS_COUNTS_1000(index, name, sample) \
230 RTC_HISTOGRAMS_COMMON(index, name, sample, \
231 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 1000, 50))
232
233 #define RTC_LOGGED_HISTOGRAMS_COUNTS_10000(index, name, sample) \
234 RTC_HISTOGRAMS_COMMON(index, name, sample, \
235 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 10000, 50))
236
237 #define RTC_LOGGED_HISTOGRAMS_COUNTS_100000(index, name, sample) \
238 RTC_HISTOGRAMS_COMMON(index, name, sample, \
239 RTC_LOGGED_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50))
240
241 #define RTC_LOGGED_HISTOGRAMS_ENUMERATION(index, name, sample, boundary) \
242 RTC_HISTOGRAMS_COMMON(index, name, sample, \
243 RTC_LOGGED_HISTOGRAM_ENUMERATION(name, sample, boundary))
244
245 #define RTC_LOGGED_HISTOGRAMS_PERCENTAGE(index, name, sample) \
246 RTC_HISTOGRAMS_COMMON(index, name, sample, \
247 RTC_LOGGED_HISTOGRAM_PERCENTAGE(name, sample))
248
249 #define RTC_HISTOGRAMS_COMMON(index, name, sample, macro_invocation) \ 177 #define RTC_HISTOGRAMS_COMMON(index, name, sample, macro_invocation) \
250 do { \ 178 do { \
251 switch (index) { \ 179 switch (index) { \
252 case 0: \ 180 case 0: \
253 macro_invocation; \ 181 macro_invocation; \
254 break; \ 182 break; \
255 case 1: \ 183 case 1: \
256 macro_invocation; \ 184 macro_invocation; \
257 break; \ 185 break; \
258 case 2: \ 186 case 2: \
(...skipping 28 matching lines...) Expand all
287 // Function for adding a |sample| to a histogram. 215 // Function for adding a |sample| to a histogram.
288 // |name| can be used to verify that it matches the histogram name. 216 // |name| can be used to verify that it matches the histogram name.
289 void HistogramAdd( 217 void HistogramAdd(
290 Histogram* histogram_pointer, const std::string& name, int sample); 218 Histogram* histogram_pointer, const std::string& name, int sample);
291 219
292 } // namespace metrics 220 } // namespace metrics
293 } // namespace webrtc 221 } // namespace webrtc
294 222
295 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ 223 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_
296 224
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/timing.cc ('k') | webrtc/video/call_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698