Add linearly spaced counting histograms
This change adds HistogramFactoryGetCountsLinear and RTC_HISTOGRAM_COUNTS_LINEAR. Note that the default implementation of HistogramFactoryGetCounts in metrics_default.cc also provides a linearly spaced histogram, while the Chrome UMA implementation provides exponentially spaced buckets. BUG=none Review-Url: https://codereview.webrtc.org/2548463002 Cr-Commit-Position: refs/heads/master@{#15367}
This commit is contained in:
parent
1454669c1d
commit
f29e05d774
@ -85,6 +85,11 @@
|
||||
RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \
|
||||
webrtc::metrics::HistogramFactoryGetCounts(name, min, max, bucket_count))
|
||||
|
||||
#define RTC_HISTOGRAM_COUNTS_LINEAR(name, sample, min, max, bucket_count) \
|
||||
RTC_HISTOGRAM_COMMON_BLOCK(name, sample, \
|
||||
webrtc::metrics::HistogramFactoryGetCountsLinear( \
|
||||
name, min, max, bucket_count))
|
||||
|
||||
// Deprecated.
|
||||
// TODO(asapersson): Remove.
|
||||
#define RTC_HISTOGRAM_COUNTS_SPARSE_100(name, sample) \
|
||||
@ -213,6 +218,12 @@ class Histogram;
|
||||
Histogram* HistogramFactoryGetCounts(
|
||||
const std::string& name, int min, int max, int bucket_count);
|
||||
|
||||
// Get histogram for counters with linear bucket spacing.
|
||||
Histogram* HistogramFactoryGetCountsLinear(const std::string& name,
|
||||
int min,
|
||||
int max,
|
||||
int bucket_count);
|
||||
|
||||
// Get histogram for enumerators.
|
||||
// |boundary| should be above the max enumerator sample.
|
||||
Histogram* HistogramFactoryGetEnumeration(
|
||||
|
||||
@ -213,6 +213,19 @@ Histogram* HistogramFactoryGetCounts(const std::string& name,
|
||||
int min,
|
||||
int max,
|
||||
int bucket_count) {
|
||||
// TODO(asapersson): Alternative implementation will be needed if this
|
||||
// histogram type should be truly exponential.
|
||||
return HistogramFactoryGetCountsLinear(name, min, max, bucket_count);
|
||||
}
|
||||
|
||||
// Histogram with linearly spaced buckets.
|
||||
// Creates (or finds) histogram.
|
||||
// The returned histogram pointer is cached (and used for adding samples in
|
||||
// subsequent calls).
|
||||
Histogram* HistogramFactoryGetCountsLinear(const std::string& name,
|
||||
int min,
|
||||
int max,
|
||||
int bucket_count) {
|
||||
RtcHistogramMap* map = GetMap();
|
||||
if (!map)
|
||||
return nullptr;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user