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}
diff --git a/webrtc/system_wrappers/source/metrics_default.cc b/webrtc/system_wrappers/source/metrics_default.cc
index d7d24fa..6ca90da 100644
--- a/webrtc/system_wrappers/source/metrics_default.cc
+++ b/webrtc/system_wrappers/source/metrics_default.cc
@@ -213,6 +213,19 @@
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;