Bug 1204994 - part 1 - add *CONTENT_DOCUMENTS_DESTROYED histograms; r=bz,vladan
authorNathan Froyd <froydnj@mozilla.com>
Tue, 15 Sep 2015 20:27:59 -0400
changeset 295788 e17c2061c0c8911eac7e23940a45581a37e34975
parent 295787 bad1e6a9f0057ecfa01759b2c166dad3e1e13b4a
child 295789 7d7181321bf11dd62e649401c03547f02b3ef11c
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)
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 1 - add *CONTENT_DOCUMENTS_DESTROYED histograms; r=bz,vladan These histograms will be used in conjunction with the revised use counter histograms to ascertain the number of pages that don't use particular features. The associated comment in nsDocument.cpp explains how things work.
dom/base/nsDocument.cpp
toolkit/components/telemetry/Histograms.json
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -13013,16 +13013,34 @@ 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);
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9454,10 +9454,20 @@
     "description": "Sync storage server authentication errors. Keyed on the Sync record name."
   },
   "WEAVE_HMAC_ERRORS": {
     "alert_emails": ["fx-team@mozilla.com"],
     "expires_in_version": "45",
     "kind": "count",
     "releaseChannelCollection": "opt-out",
     "description": "Sync cryptoKeys collection HMAC mismatches."
+  },
+  "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"
   }
 }