Add support to increase a UMA histogram bucket by an aribitrary integer.
The UMA code supports counting events that fall into ranges (buckets),
and this is implemented by adding 1 to the count for particular range.
The change is to add an arbitrary amount to a bucket on a single event.
To achieve this goal, we have added MultiAdd function to Histogram and
SparseHistogram classes. So the user of these classes will be able to
increase the count number of a bucket in these classes by an arbitrary
integer instead of one which is hardcoded in their Add function.
BUG=514317
Review URL: https://codereview.chromium.org/1256363002
Cr-Commit-Position: refs/heads/master@{#341961}
diff --git a/base/metrics/histogram_base.h b/base/metrics/histogram_base.h
index 1bc1f6e..304e3e03 100644
--- a/base/metrics/histogram_base.h
+++ b/base/metrics/histogram_base.h
@@ -121,6 +121,12 @@
virtual void Add(Sample value) = 0;
+ // In Add function the |value| bucket is increased by one, but in some use
+ // cases we need to increase this value by an arbitrary integer. AddCount
+ // function increases the |value| bucket by |count|. |count| should be greater
+ // than or equal to 1.
+ virtual void AddCount(Sample value, int count) = 0;
+
// 2 convenient functions that call Add(Sample).
void AddTime(const TimeDelta& time);
void AddBoolean(bool value);