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

Unified Diff: base/metrics/sparse_histogram.cc

Issue 1256363002: Add support to increase a UMA histogram bucket by an aribitrary integer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After rebase-update Created 5 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/sparse_histogram.h ('k') | base/metrics/sparse_histogram_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/sparse_histogram.cc
diff --git a/base/metrics/sparse_histogram.cc b/base/metrics/sparse_histogram.cc
index a853dce3505f450c5ef814371f63f1fa92e7523f..39c276d7877290a9a93123b728061cb06099c51b 100644
--- a/base/metrics/sparse_histogram.cc
+++ b/base/metrics/sparse_histogram.cc
@@ -46,9 +46,17 @@ bool SparseHistogram::HasConstructionArguments(
}
void SparseHistogram::Add(Sample value) {
+ AddCount(value, 1);
+}
+
+void SparseHistogram::AddCount(Sample value, int count) {
+ if (count <= 0) {
+ NOTREACHED();
+ return;
+ }
{
base::AutoLock auto_lock(lock_);
- samples_.Accumulate(value, 1);
+ samples_.Accumulate(value, count);
}
FindAndRunCallback(value);
« no previous file with comments | « base/metrics/sparse_histogram.h ('k') | base/metrics/sparse_histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698