Backout c5b25c30befc:b217dfd70e22 (bug 1204994) for browser-chrome oranges; r=me
authorNathan Froyd <froydnj@mozilla.com>
Thu, 17 Sep 2015 05:09:13 -0400
changeset 295545 42e8d6b514a91adf9e9b7ea31a78e6374e0b3432
parent 295544 eec5dceb90b18eb7714d1b5c65d6518c6ce8efc2
child 295546 aaec3b268d06681560f5ade7af640728092f6600
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1204994
milestone43.0a1
backs outc5b25c30befc555a669338a15badd715744923ab
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
Backout c5b25c30befc:b217dfd70e22 (bug 1204994) for browser-chrome oranges; r=me
dom/base/nsDocument.cpp
dom/base/test/browser_use_counters.js
dom/base/usecounters.py
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/gen-histogram-enum.py
toolkit/components/telemetry/histogram_tools.py
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13038,74 +13038,52 @@ nsDocument::ReportUseCounters()
     // certain features were removed.  Consider the case of a single
     // HTML document with several SVG images and/or iframes with
     // sub-documents of their own.  If we maintained a single set of use
     // counters and all the sub-documents use a particular feature, then
     // telemetry would indicate that we would be breaking N documents if
     // that feature were removed.  Whereas with a document/top-level
     // page split, we can see that N documents would be affected, but
     // only a single web page would be affected.
-
-    // The difference between the values of these two histograms and the
-    // related use counters below tell us how many pages did *not* use
-    // the feature in question.  For instance, if we see that a given
-    // session has destroyed 30 content documents, but a particular use
-    // counter shows only a count of 5, we can infer that the use
-    // counter was *not* used in 25 of those 30 documents.
-    //
-    // We do things this way, rather than accumulating a boolean flag
-    // for each use counter, to avoid sending histograms for features
-    // that don't get widely used.  Doing things in this fashion means
-    // smaller telemetry payloads and faster processing on the server
-    // side.
-    Telemetry::Accumulate(Telemetry::CONTENT_DOCUMENTS_DESTROYED, 1);
-    if (IsTopLevelContentDocument()) {
-      Telemetry::Accumulate(Telemetry::TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED, 1);
-    }
-
     for (int32_t c = 0;
          c < eUseCounter_Count; ++c) {
       UseCounter uc = static_cast<UseCounter>(c);
       
       Telemetry::ID id =
         static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter + uc * 2);
       bool value = GetUseCounter(uc);
 
-      if (value) {
-        if (sDebugUseCounters) {
+      if (sDebugUseCounters && value) {
+        const char* name = Telemetry::GetHistogramName(id);
+        if (name) {
+          printf("  %s", name);
+        } else {
+          printf("  #%d", id);
+        }
+        printf(": %d\n", value);
+      }
+
+      Telemetry::Accumulate(id, value);
+
+      if (IsTopLevelContentDocument()) {
+        id = static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter +
+                                        uc * 2 + 1);
+        value = GetUseCounter(uc) || GetChildDocumentUseCounter(uc);
+
+        if (sDebugUseCounters && value) {
           const char* name = Telemetry::GetHistogramName(id);
           if (name) {
             printf("  %s", name);
           } else {
             printf("  #%d", id);
           }
           printf(": %d\n", 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,38 +99,34 @@ 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_COUNTER2_" + arg.middlefix + "_PAGE";
-    let histogram_document_name = "USE_COUNTER2_" + arg.middlefix + "_DOCUMENT";
+    let histogram_page_name = "USE_COUNTER_" + arg.middlefix + "_PAGE";
+    let histogram_document_name = "USE_COUNTER_" + arg.middlefix + "_DOCUMENT";
     let histogram_page = snapshot_histogram(histogram_page_name);
     let histogram_document = snapshot_histogram(histogram_document_name);
-    let histogram_docs = snapshot_histogram("CONTENT_DOCUMENTS_DESTROYED");
-    let histogram_toplevel_docs = snapshot_histogram("TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED");
-    return [histogram_page.sum, histogram_document.sum,
-            histogram_docs.sum, histogram_toplevel_docs.sum];
+    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);
 
   let newTab = gBrowser.addTab( "about:blank");
   gBrowser.selectedTab = newTab;
   newTab.linkedBrowser.stop();
 
   // Hold on to the current values of the telemetry histograms we're
   // interested in.
-  let [histogram_page_before, histogram_document_before,
-       histogram_docs_before, histogram_toplevel_docs_before] =
+  let [histogram_page_before, histogram_document_before] =
       yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
 
   gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html");
   yield waitForPageLoad(gBrowser.selectedBrowser);
 
   // Inject our desired file into the iframe of the newly-loaded page.
   yield ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(opts) {
     Cu.import("resource://gre/modules/PromiseUtils.jsm");
@@ -160,41 +156,37 @@ var check_use_counter_iframe = Task.asyn
   gBrowser.removeTab(newTab);
 
   // The histograms only get recorded when the document actually gets
   // destroyed, which might not have happened yet due to GC/CC effects, etc.
   // Try to force document destruction.
   yield waitForDestroyedDocuments();
 
   // Grab histograms again and compare.
-  let [histogram_page_after, histogram_document_after,
-       histogram_docs_after, histogram_toplevel_docs_after] =
+  let [histogram_page_after, histogram_document_after] =
       yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
 
   is(histogram_page_after, histogram_page_before + 1,
      "page counts for " + use_counter_middlefix + " after are correct");
-  is(histogram_toplevel_docs_after, histogram_toplevel_docs_before + 1,
-     "top level document counts are correct");
   if (check_documents) {
     is(histogram_document_after, histogram_document_before + 1,
-       "document counts for " + use_counter_middlefix + " after are correct");
+       "document counts " + use_counter_middlefix + " after are correct");
   }
 });
 
 var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
   info("checking " + file + " as image with histogram " + use_counter_middlefix);
 
   let newTab = gBrowser.addTab("about:blank");
   gBrowser.selectedTab = newTab;
   newTab.linkedBrowser.stop();
 
   // Hold on to the current values of the telemetry histograms we're
   // interested in.
-  let [histogram_page_before, histogram_document_before,
-       histogram_docs_before, histogram_toplevel_docs_before] =
+  let [histogram_page_before, histogram_document_before] =
       yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
 
   gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html");
   yield waitForPageLoad(gBrowser.selectedBrowser);
 
   // Inject our desired file into the img of the newly-loaded page.
   yield ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(opts) {
     Cu.import("resource://gre/modules/PromiseUtils.jsm");
@@ -225,42 +217,34 @@ var check_use_counter_img = Task.async(f
   gBrowser.removeTab(newTab);
 
   // The histograms only get recorded when the document actually gets
   // destroyed, which might not have happened yet due to GC/CC effects, etc.
   // Try to force document destruction.
   yield waitForDestroyedDocuments();
 
   // Grab histograms again and compare.
-  let [histogram_page_after, histogram_document_after,
-       histogram_docs_after, histogram_toplevel_docs_after] =
+  let [histogram_page_after, histogram_document_after] =
       yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
   is(histogram_page_after, histogram_page_before + 1,
      "page counts for " + use_counter_middlefix + " after are correct");
   is(histogram_document_after, histogram_document_before + 1,
-     "document counts for " + use_counter_middlefix + " after are correct");
-  is(histogram_toplevel_docs_after, histogram_toplevel_docs_before + 1,
-     "top level document counts are correct");
-  // 2 documents: one for the outer html page containing the <img> element, and
-  // one for the SVG image itself.
-  is(histogram_docs_after, histogram_docs_before + 2,
-     "document counts are correct");
+     "document counts " + use_counter_middlefix + " after are correct");
 });
 
 var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix, xfail=false) {
   info("checking " + file + " with histogram " + use_counter_middlefix);
 
   let newTab = gBrowser.addTab( "about:blank");
   gBrowser.selectedTab = newTab;
   newTab.linkedBrowser.stop();
 
   // Hold on to the current values of the telemetry histograms we're
   // interested in.
-  let [histogram_page_before, histogram_document_before,
-       histogram_docs_before, histogram_toplevel_docs_before] =
+  let [histogram_page_before, histogram_document_before] =
       yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
 
   gBrowser.selectedBrowser.loadURI(gHttpTestRoot + file);
   yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
     Cu.import("resource://gre/modules/PromiseUtils.jsm");
     yield new Promise(resolve => {
       let listener = () => {
         removeEventListener("load", listener, true);
@@ -278,20 +262,15 @@ var check_use_counter_direct = Task.asyn
   gBrowser.removeTab(newTab);
 
   // The histograms only get recorded when the document actually gets
   // destroyed, which might not have happened yet due to GC/CC effects, etc.
   // Try to force document destruction.
   yield waitForDestroyedDocuments();
 
   // Grab histograms again and compare.
-  let [histogram_page_after, histogram_document_after,
-       histogram_docs_after, histogram_toplevel_docs_after] =
+  let [histogram_page_after, histogram_document_after] =
       yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix);
   (xfail ? todo_is : is)(histogram_page_after, histogram_page_before + 1,
                          "page counts for " + use_counter_middlefix + " after are correct");
   (xfail ? todo_is : is)(histogram_document_after, histogram_document_before + 1,
-                         "document counts for " + use_counter_middlefix + " after are correct");
-  is(histogram_toplevel_docs_after, histogram_toplevel_docs_before + 1,
-     "top level document counts are correct");
-  is(histogram_docs_after, histogram_docs_before + 1,
-     "document counts are correct");
+                         "document counts " + use_counter_middlefix + " after are correct");
 });
--- 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_COUNTER2_%s_DOCUMENT' % name, 'Whether a document %s' % desc)
-            append_counter('USE_COUNTER2_%s_PAGE' % name, 'Whether a page %s' % 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)
 
         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/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9343,26 +9343,16 @@
   "VIDEO_EME_ADOBE_UNSUPPORTED_REASON": {
     "alert_emails": ["edwin@mozilla.com"],
     "expires_in_version": "50",
     "kind": "enumerated",
     "n_values": 10,
     "releaseChannelCollection": "opt-out",
     "description": "Reason for reporting the Adobe CDM to be unsupported. (1 = NOT_WINDOWS; 2 = WINDOWS_VERSION)"
   },
-  "CONTENT_DOCUMENTS_DESTROYED": {
-    "expires_in_version": "never",
-    "kind": "count",
-    "description": "Number of content documents destroyed; used in conjunction with use counter histograms"
-  },
-  "TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED": {
-    "expires_in_version": "never",
-    "kind": "count",
-    "description": "Number of top-level content documents destroyed; used in conjunction with use counter histograms"
-  },
   "FXA_CONFIGURED": {
     "alert_emails": ["fx-team@mozilla.com"],
     "expires_in_version": "45",
     "kind": "flag",
     "releaseChannelCollection": "opt-out",
     "description": "If the user is signed in to a Firefox Account on this device"
   },
   "FXA_UNVERIFIED_ACCOUNT_ERRORS": {
--- 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_COUNTER2_"))
+                               lambda h: h.name().startswith("USE_COUNTER_"))
     seen_use_counters = False
 
-    # Note that histogram_tools.py guarantees that all of the USE_COUNTER2_*
+    # Note that histogram_tools.py guarantees that all of the USE_COUNTER_*
     # 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_COUNTER2_DEPRECATED_%s_%s' % (op, context.upper())
+                name = 'USE_COUNTER_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_COUNTER2_* histograms be defined in a contiguous
+    # We require that all USE_COUNTER_* histograms be defined in a contiguous
     # block.
-    use_counter_indices = filter(lambda x: x[1].startswith("USE_COUNTER2_"),
+    use_counter_indices = filter(lambda x: x[1].startswith("USE_COUNTER_"),
                                  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"