summaryrefslogtreecommitdiffstats
path: root/base/metrics/histogram.h
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-14 01:48:32 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-14 01:48:32 +0000
commitc340bf4185b0cfba66eae8299fce69741553e335 (patch)
tree60d445a43c07865eafa18f219e078231a11576e8 /base/metrics/histogram.h
parent27315ce408fc3e67c5195704ecb61b5462ce01fc (diff)
downloadchromium_src-c340bf4185b0cfba66eae8299fce69741553e335.zip
chromium_src-c340bf4185b0cfba66eae8299fce69741553e335.tar.gz
chromium_src-c340bf4185b0cfba66eae8299fce69741553e335.tar.bz2
Expand the inline documentation for the HISTOGRAM_ENUMERATION macros.
This should help to reduce confusion about the recommended upper- and lower-bounds for enumerated histograms. BUG=none TEST=none Review URL: http://codereview.chromium.org/8273022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/metrics/histogram.h')
-rw-r--r--base/metrics/histogram.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index 7a73f96..401ece7 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -163,7 +163,11 @@ class Lock;
base::Histogram::kNoFlags))
// Support histograming of an enumerated value. The samples should always be
-// less than boundary_value.
+// strictly less than |boundary_value| -- this prevents you from running into
+// 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.
#define HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
@@ -266,6 +270,8 @@ class Lock;
base::BooleanHistogram::FactoryGet(name, \
base::Histogram::kUmaTargetedHistogramFlag))
+// The samples should always be strictly less than |boundary_value|. For more
+// details, see the comment for the |HISTOGRAM_ENUMERATION| macro, above.
#define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
base::LinearHistogram::FactoryGet(name, 1, boundary_value, \