Bug 1204994 - part 2 - rename all USE_COUNTER_* histograms to USE_COUNTER2_* histograms; r=bz,vladan
authorNathan Froyd <froydnj@mozilla.com>
Tue, 15 Sep 2015 20:44:37 -0400
changeset 263155 7d7181321bf11dd62e649401c03547f02b3ef11c
parent 263154 e17c2061c0c8911eac7e23940a45581a37e34975
child 263156 e8bb18a02a560187ed66d852685ecf84b58d1378
push id65227
push usernfroyd@mozilla.com
push dateFri, 18 Sep 2015 03:43:30 +0000
treeherdermozilla-inbound@e8bb18a02a56 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, vladan
bugs1204994
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1204994 - part 2 - rename all USE_COUNTER_* histograms to USE_COUNTER2_* histograms; r=bz,vladan We're changing the definition of each of the use counter histograms. Therefore, they need new names, so as to not throw wrenches into the server-side machinery. This renaming is the most straightforward way to do things and similar to how we have renamed other histograms before.
dom/base/nsDocument.cpp
dom/base/test/browser_use_counters.js
dom/base/usecounters.py
toolkit/components/telemetry/gen-histogram-enum.py
toolkit/components/telemetry/histogram_tools.py
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13049,38 +13049,38 @@ nsDocument::ReportUseCounters()
           const char* name = Telemetry::GetHistogramName(id);
           if (name) {
             printf("  %s", name);
           } else {
             printf("  #%d", id);
           }
           printf(": %d\n", value);
         }
-      }
-
-      Telemetry::Accumulate(id, value);
+
+        Telemetry::Accumulate(id, 1);
+      }
 
       if (IsTopLevelContentDocument()) {
         id = static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter +
                                         uc * 2 + 1);
         value = GetUseCounter(uc) || GetChildDocumentUseCounter(uc);
 
         if (value) {
           if (sDebugUseCounters) {
             const char* name = Telemetry::GetHistogramName(id);
             if (name) {
               printf("  %s", name);
             } else {
               printf("  #%d", id);
             }
             printf(": %d\n", value);
           }
+
+          Telemetry::Accumulate(id, 1);
         }
-
-        Telemetry::Accumulate(id, value);
       }
     }
   }
 }
 
 XPathEvaluator*
 nsIDocument::XPathEvaluator()
 {
--- a/dom/base/test/browser_use_counters.js
+++ b/dom/base/test/browser_use_counters.js
@@ -99,18 +99,18 @@ function waitForPageLoad(browser) {
 
 function grabHistogramsFromContent(browser, use_counter_middlefix) {
   return ContentTask.spawn(browser, { middlefix: use_counter_middlefix }, function* (arg) {
     let telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
     function snapshot_histogram(name) {
       return telemetry.getHistogramById(name).snapshot();
     }
 
-    let histogram_page_name = "USE_COUNTER_" + arg.middlefix + "_PAGE";
-    let histogram_document_name = "USE_COUNTER_" + arg.middlefix + "_DOCUMENT";
+    let histogram_page_name = "USE_COUNTER2_" + arg.middlefix + "_PAGE";
+    let histogram_document_name = "USE_COUNTER2_" + arg.middlefix + "_DOCUMENT";
     let histogram_page = snapshot_histogram(histogram_page_name);
     let histogram_document = snapshot_histogram(histogram_document_name);
     return [histogram_page.sum, histogram_document.sum];
   });
 }
 
 var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix, check_documents=true) {
   info("checking " + file + " with histogram " + use_counter_middlefix);
--- a/dom/base/usecounters.py
+++ b/dom/base/usecounters.py
@@ -57,18 +57,18 @@ def generate_histograms(filename):
     items = collections.OrderedDict()
     for counter in read_conf(filename):
         def append_counter(name, desc):
             items[name] = { 'expires_in_version': 'never',
                             'kind' : 'boolean',
                             'description': desc }
 
         def append_counters(name, desc):
-            append_counter('USE_COUNTER_%s_DOCUMENT' % name, 'Whether a document %s' % desc)
-            append_counter('USE_COUNTER_%s_PAGE' % name, 'Whether a page %s' % desc)
+            append_counter('USE_COUNTER2_%s_DOCUMENT' % name, 'Whether a document %s' % desc)
+            append_counter('USE_COUNTER2_%s_PAGE' % name, 'Whether a page %s' % desc)
 
         if counter['type'] == 'method':
             method = '%s.%s' % (counter['interface_name'], counter['method_name'])
             append_counters(method.replace('.', '_').upper(), 'called %s' % method)
         elif counter['type'] == 'attribute':
             attr = '%s.%s' % (counter['interface_name'], counter['attribute_name'])
             counter_name = attr.replace('.', '_').upper()
             append_counters('%s_getter' % counter_name, 'got %s' % attr)
--- a/toolkit/components/telemetry/gen-histogram-enum.py
+++ b/toolkit/components/telemetry/gen-histogram-enum.py
@@ -21,20 +21,20 @@ import sys
 banner = """/* This file is auto-generated, see gen-histogram-enum.py.  */
 """
 
 def main(output, *filenames):
     print(banner, file=output)
     print("enum ID : uint32_t {", file=output)
 
     groups = itertools.groupby(histogram_tools.from_files(filenames),
-                               lambda h: h.name().startswith("USE_COUNTER_"))
+                               lambda h: h.name().startswith("USE_COUNTER2_"))
     seen_use_counters = False
 
-    # Note that histogram_tools.py guarantees that all of the USE_COUNTER_*
+    # Note that histogram_tools.py guarantees that all of the USE_COUNTER2_*
     # histograms are defined in a contiguous block.  We therefore assume
     # that there's at most one group for which use_counter_group is true.
     for (use_counter_group, histograms) in groups:
         if use_counter_group:
             seen_use_counters = True
 
         # The HistogramDUMMY* enum variables are used to make the computation
         # of Histogram{First,Last}UseCounter easier.  Otherwise, we'd have to
--- a/toolkit/components/telemetry/histogram_tools.py
+++ b/toolkit/components/telemetry/histogram_tools.py
@@ -288,17 +288,17 @@ def from_nsDeprecatedOperationList(filen
         for line in f:
             match = operation_regex.search(line)
             if not match:
                 continue
 
             op = match.group(1)
 
             def add_counter(context):
-                name = 'USE_COUNTER_DEPRECATED_%s_%s' % (op, context.upper())
+                name = 'USE_COUNTER2_DEPRECATED_%s_%s' % (op, context.upper())
                 histograms[name] = {
                     'expires_in_version': 'never',
                     'kind': 'boolean',
                     'description': 'Whether a %s used %s' % (context, op)
                 }
             add_counter('document')
             add_counter('page')
 
@@ -334,19 +334,19 @@ the histograms defined in filenames.
         if not isinstance(histograms, OrderedDict):
             raise BaseException, "histogram parser didn't provide an OrderedDict"
 
         for (name, definition) in histograms.iteritems():
             if all_histograms.has_key(name):
                 raise DefinitionException, "duplicate histogram name %s" % name
             all_histograms[name] = definition
 
-    # We require that all USE_COUNTER_* histograms be defined in a contiguous
+    # We require that all USE_COUNTER2_* histograms be defined in a contiguous
     # block.
-    use_counter_indices = filter(lambda x: x[1].startswith("USE_COUNTER_"),
+    use_counter_indices = filter(lambda x: x[1].startswith("USE_COUNTER2_"),
                                  enumerate(all_histograms.iterkeys()));
     if use_counter_indices:
         lower_bound = use_counter_indices[0][0]
         upper_bound = use_counter_indices[-1][0]
         n_counters = upper_bound - lower_bound + 1
         if n_counters != len(use_counter_indices):
             raise DefinitionException, "use counter histograms must be defined in a contiguous block"