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

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

Issue 1530913002: Rename RTC_HISTOGRAM_* macros to RTC_HISTOGRAM_*_SPARSE_* to indicate that these are for infrequent (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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/receive_statistics_proxy.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // NOTE: this is a temporary solution. 62 // NOTE: this is a temporary solution.
63 // The aim is to mimic the behaviour in Chromium's src/base/metrics/histograms.h 63 // The aim is to mimic the behaviour in Chromium's src/base/metrics/histograms.h
64 // However as atomics are not supported in webrtc, this is for now a modified 64 // However as atomics are not supported in webrtc, this is for now a modified
65 // and temporary solution. Note that the histogram is constructed/found for 65 // and temporary solution. Note that the histogram is constructed/found for
66 // each call. Therefore, for now only use this implementation for metrics 66 // each call. Therefore, for now only use this implementation for metrics
67 // that do not need to be updated frequently. 67 // that do not need to be updated frequently.
68 // TODO(asapersson): Change implementation when atomics are supported. 68 // TODO(asapersson): Change implementation when atomics are supported.
69 // Also consider changing string to const char* when switching to atomics. 69 // Also consider changing string to const char* when switching to atomics.
70 70
71 // Histogram for counters. 71 // Histogram for counters.
72 #define RTC_HISTOGRAM_COUNTS_100(name, sample) RTC_HISTOGRAM_COUNTS( \ 72 #define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \
73 name, sample, 1, 100, 50) 73 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100, 50)
74 74
75 #define RTC_HISTOGRAM_COUNTS_200(name, sample) RTC_HISTOGRAM_COUNTS( \ 75 #define RTC_HISTOGRAM_COUNTS_SPARSE_200(name, sample) \
76 name, sample, 1, 200, 50) 76 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 200, 50)
77 77
78 #define RTC_HISTOGRAM_COUNTS_1000(name, sample) RTC_HISTOGRAM_COUNTS( \ 78 #define RTC_HISTOGRAM_COUNTS_SPARSE_1000(name, sample) \
79 name, sample, 1, 1000, 50) 79 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 1000, 50)
80 80
81 #define RTC_HISTOGRAM_COUNTS_10000(name, sample) RTC_HISTOGRAM_COUNTS( \ 81 #define RTC_HISTOGRAM_COUNTS_SPARSE_10000(name, sample) \
82 name, sample, 1, 10000, 50) 82 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 10000, 50)
83 83
84 #define RTC_HISTOGRAM_COUNTS_100000(name, sample) RTC_HISTOGRAM_COUNTS( \ 84 #define RTC_HISTOGRAM_COUNTS_SPARSE_100000(name, sample) \
85 name, sample, 1, 100000, 50) 85 RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, 1, 100000, 50)
86 86
87 #define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ 87 #define RTC_HISTOGRAM_COUNTS_SPARSE(name, sample, min, max, bucket_count) \
88 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ 88 RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \
89 webrtc::metrics::HistogramFactoryGetCounts( \ 89 webrtc::metrics::HistogramFactoryGetCounts( \
90 name, min, max, bucket_count)) 90 name, min, max, bucket_count))
91 91
92 // Histogram for percentage. 92 // Histogram for percentage.
93 #define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ 93 #define RTC_HISTOGRAM_PERCENTAGE_SPARSE(name, sample) \
94 RTC_HISTOGRAM_ENUMERATION(name, sample, 101) 94 RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, 101)
95 95
96 // Histogram for enumerators. 96 // Histogram for enumerators.
97 // |boundary| should be above the max enumerator sample. 97 // |boundary| should be above the max enumerator sample.
98 #define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ 98 #define RTC_HISTOGRAM_ENUMERATION_SPARSE(name, sample, boundary) \
99 RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ 99 RTC_HISTOGRAM_COMMON_BLOCK_SLOW(name, sample, \
100 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) 100 webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary))
101 101
102 #define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \ 102 #define RTC_HISTOGRAM_COMMON_BLOCK_SLOW(constant_name, sample, \
103 factory_get_invocation) \ 103 factory_get_invocation) \
104 do { \ 104 do { \
105 webrtc::metrics::Histogram* histogram_pointer = factory_get_invocation; \ 105 webrtc::metrics::Histogram* histogram_pointer = factory_get_invocation; \
106 webrtc::metrics::HistogramAdd(histogram_pointer, constant_name, sample); \ 106 webrtc::metrics::HistogramAdd(histogram_pointer, constant_name, sample); \
107 } while (0) 107 } while (0)
108 108
109
110 namespace webrtc { 109 namespace webrtc {
111 namespace metrics { 110 namespace metrics {
112 111
113 // Time that should have elapsed for stats that are gathered once per call. 112 // Time that should have elapsed for stats that are gathered once per call.
114 enum { kMinRunTimeInSeconds = 10 }; 113 enum { kMinRunTimeInSeconds = 10 };
115 114
116 class Histogram; 115 class Histogram;
117 116
118 // Functions for getting pointer to histogram (constructs or finds the named 117 // Functions for getting pointer to histogram (constructs or finds the named
119 // histogram). 118 // histogram).
(...skipping 10 matching lines...) Expand all
130 // Function for adding a |sample| to a histogram. 129 // Function for adding a |sample| to a histogram.
131 // |name| can be used to verify that it matches the histogram name. 130 // |name| can be used to verify that it matches the histogram name.
132 void HistogramAdd( 131 void HistogramAdd(
133 Histogram* histogram_pointer, const std::string& name, int sample); 132 Histogram* histogram_pointer, const std::string& name, int sample);
134 133
135 } // namespace metrics 134 } // namespace metrics
136 } // namespace webrtc 135 } // namespace webrtc
137 136
138 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_ 137 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_METRICS_H_
139 138
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/timing.cc ('k') | webrtc/video/receive_statistics_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698