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

Unified Diff: base/metrics/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/histogram.h ('k') | base/metrics/histogram_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.cc
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index 7ff1b16184f10c9e54dd501b1b95a1f34fefc253..b37bc4c4685c5476c9145a81bb953ddfbc2532d5 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -272,6 +272,10 @@ bool Histogram::HasConstructionArguments(Sample expected_minimum,
}
void Histogram::Add(int value) {
+ AddCount(value, 1);
+}
+
+void Histogram::AddCount(int value, int count) {
DCHECK_EQ(0, ranges(0));
DCHECK_EQ(kSampleType_MAX, ranges(bucket_count()));
@@ -279,7 +283,11 @@ void Histogram::Add(int value) {
value = kSampleType_MAX - 1;
if (value < 0)
value = 0;
- samples_->Accumulate(value, 1);
+ if (count <= 0) {
+ NOTREACHED();
+ return;
+ }
+ samples_->Accumulate(value, count);
FindAndRunCallback(value);
}
« no previous file with comments | « base/metrics/histogram.h ('k') | base/metrics/histogram_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698