Chromium Code Reviews| Index: webrtc/system_wrappers/include/metrics.h |
| diff --git a/webrtc/system_wrappers/include/metrics.h b/webrtc/system_wrappers/include/metrics.h |
| index b0a77c8711a7c33b247f91f7c3750697b108af75..bba6ab1e21bb1c00eea4f7456c302728e495e09c 100644 |
| --- a/webrtc/system_wrappers/include/metrics.h |
| +++ b/webrtc/system_wrappers/include/metrics.h |
| @@ -16,6 +16,7 @@ |
| #include "webrtc/base/atomicops.h" |
| #include "webrtc/base/checks.h" |
| #include "webrtc/common_types.h" |
| +#include "webrtc/system_wrappers/include/logging.h" |
|
stefan-webrtc
2016/03/15 10:14:10
Should we use webrtc/base/logging.h?
åsapersson
2016/03/15 12:46:23
Done.
|
| // Macros for allowing WebRTC clients (e.g. Chrome) to gather and aggregate |
| // statistics. |
| @@ -78,7 +79,27 @@ |
| RTC_HISTOGRAM_COUNTS(name, sample, 1, 100000, 50) |
| #define RTC_HISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ |
| - RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ |
| + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, false, \ |
| + webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) |
| + |
| +// RTC_HISTOGRAM_COUNTS with logging. |
| +#define RTC_LHISTOGRAM_COUNTS_100(name, sample) \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 100, 50) |
| + |
| +#define RTC_LHISTOGRAM_COUNTS_200(name, sample) \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 200, 50) |
| + |
| +#define RTC_LHISTOGRAM_COUNTS_1000(name, sample) \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 1000, 50) |
| + |
| +#define RTC_LHISTOGRAM_COUNTS_10000(name, sample) \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 10000, 50) |
| + |
| +#define RTC_LHISTOGRAM_COUNTS_100000(name, sample) \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 100000, 50) |
| + |
| +#define RTC_LHISTOGRAM_COUNTS(name, sample, min, max, bucket_count) \ |
| + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, true, \ |
| webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count)) |
| // Deprecated. |
| @@ -94,17 +115,29 @@ |
| #define RTC_HISTOGRAM_PERCENTAGE(name, sample) \ |
| RTC_HISTOGRAM_ENUMERATION(name, sample, 101) |
| +// RTC_HISTOGRAM_PERCENTAGE with logging. |
| +#define RTC_LHISTOGRAM_PERCENTAGE(name, sample) \ |
| + RTC_LHISTOGRAM_ENUMERATION(name, sample, 101) |
| + |
| // Histogram for enumerators (evenly spaced buckets). |
| // |boundary| should be above the max enumerator sample. |
| #define RTC_HISTOGRAM_ENUMERATION(name, sample, boundary) \ |
| - RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \ |
| + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, false, \ |
| + webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) |
| + |
| +// RTC_HISTOGRAM_ENUMERATION with logging. |
| +#define RTC_LHISTOGRAM_ENUMERATION(name, sample, boundary) \ |
| + RTC_HISTOGRAM_COMMON_BLOCK(name, sample, true, \ |
| webrtc::metrics::HistogramFactoryGetEnumeration(name, boundary)) |
| // The name of the histogram should not vary. |
| // TODO(asapersson): Consider changing string to const char*. |
| -#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, \ |
| +#define RTC_HISTOGRAM_COMMON_BLOCK(constant_name, sample, log, \ |
| factory_get_invocation) \ |
| do { \ |
| + if (log) { \ |
| + LOG(LS_INFO) << constant_name << " " << sample; \ |
| + } \ |
| static webrtc::metrics::Histogram* atomic_histogram_pointer = nullptr; \ |
| webrtc::metrics::Histogram* histogram_pointer = \ |
| rtc::AtomicOps::AcquireLoadPtr(&atomic_histogram_pointer); \ |
| @@ -162,6 +195,35 @@ |
| RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| RTC_HISTOGRAM_PERCENTAGE(name, sample)) |
| +// RTC_HISTOGRAMS_COUNTS with logging. |
| +#define RTC_LHISTOGRAMS_COUNTS_100(index, name, sample) \ |
| + RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 100, 50)) |
| + |
| +#define RTC_LHISTOGRAMS_COUNTS_200(index, name, sample) \ |
| + RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 200, 50)) |
| + |
| +#define RTC_LHISTOGRAMS_COUNTS_1000(index, name, sample) \ |
| + RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 1000, 50)) |
| + |
| +#define RTC_LHISTOGRAMS_COUNTS_10000(index, name, sample) \ |
| + RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 10000, 50)) |
| + |
| +#define RTC_LHISTOGRAMS_COUNTS_100000(index, name, sample) \ |
| + RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| + RTC_LHISTOGRAM_COUNTS(name, sample, 1, 100000, 50)) |
| + |
| +#define RTC_LHISTOGRAMS_ENUMERATION(index, name, sample, boundary) \ |
| + RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| + RTC_LHISTOGRAM_ENUMERATION(name, sample, boundary)) |
| + |
| +#define RTC_LHISTOGRAMS_PERCENTAGE(index, name, sample) \ |
| + RTC_HISTOGRAMS_COMMON(index, name, sample, \ |
| + RTC_LHISTOGRAM_PERCENTAGE(name, sample)) |
| + |
| #define RTC_HISTOGRAMS_COMMON(index, name, sample, macro_invocation) \ |
| do { \ |
| switch (index) { \ |