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

Unified Diff: base/metrics/histogram_macros.h

Issue 2169863003: Comment on UMA_HISTOGRAM_ENUMERATION that explains an overflow bucket (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polishing the text. Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_macros.h
diff --git a/base/metrics/histogram_macros.h b/base/metrics/histogram_macros.h
index ce1811a5a7ae3e88af49b9127c6cf3c54d084325..dcde7255c8dafee8e28c09e21baf492408ea8682 100644
--- a/base/metrics/histogram_macros.h
+++ b/base/metrics/histogram_macros.h
@@ -145,6 +145,9 @@
base::HistogramBase::kNoFlags))
// This is a helper macro used by other macros and shouldn't be used directly.
+// One additional bucket is created in the LinearHistogram for the illegal
+// values >= boundary_value so that mistakes in calling the UMA enumeration
+// macros can be detected.
#define HISTOGRAM_ENUMERATION_WITH_FLAG(name, sample, boundary, flag) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1, \
@@ -162,7 +165,9 @@
// problems down the line if you add additional buckets to the histogram. Note
// also that, despite explicitly setting the minimum bucket value to |1| below,
// it is fine for enumerated histograms to be 0-indexed -- this is because
-// enumerated histograms should never have underflow.
+// enumerated histograms should never have underflow. One additional bucket is
+// created in the LinearHistogram for the illegal values >= boundary_value so
+// that mistakes in calling this macro can be detected.
#define LOCAL_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698