Bug 764585 - make enumerated histograms harder to get wrong; r=taras
authorNathan Froyd <froydnj@mozilla.com>
Tue, 28 Aug 2012 13:21:56 -0400
changeset 105742 30c7ffa7bd97ca5709edeb0567ba9868714233dd
parent 105741 020c834a8991eb38904817fd64e3089f03d236a4
child 105743 e25785cfd8ad507dbd2dcced1031c3a1d187934d
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewerstaras
bugs764585
milestone18.0a1
Bug 764585 - make enumerated histograms harder to get wrong; r=taras
toolkit/components/telemetry/gen-histogram-data.py
--- a/toolkit/components/telemetry/gen-histogram-data.py
+++ b/toolkit/components/telemetry/gen-histogram-data.py
@@ -55,16 +55,18 @@ def static_asserts_for_enumerated(histog
 def shared_static_asserts(histogram):
     name = histogram.name()
     low = histogram.low()
     high = histogram.high()
     n_buckets = histogram.n_buckets()
     static_assert("%s < %s" % (low, high), "low >= high for %s" % name)
     static_assert("%s > 2" % n_buckets, "Not enough values for %s" % name)
     static_assert("%s >= 1" % low, "Incorrect low value for %s" % name)
+    static_assert("%s > %s" % (high, n_buckets),
+                  "high must be > number of buckets for %s; you may want an enumerated histogram" % name)
 
 def static_asserts_for_linear(histogram):
     shared_static_asserts(histogram)
 
 def static_asserts_for_exponential(histogram):
     shared_static_asserts(histogram)
 
 def write_histogram_static_asserts(histograms):