Bug 1454724 - Add scalar telemetry for max ghost windows. r=chutten
authorAndrew McCreight <continuation@gmail.com>
Wed, 18 Apr 2018 11:56:53 -0700
changeset 468032 7b01ccfbcc6e11c3fc8c7a469e80741cd711a277
parent 468031 5e5d90268f94fc3e47b06b33092f28831ec0daf5
child 468033 154e987909aabcb08fa0c20a0446a83ea802825d
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1454724
milestone61.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 1454724 - Add scalar telemetry for max ghost windows. r=chutten Rather than recording how many leaked (ghost) windows we see at various times, I think it will be more useful over all to record what the maximum number of ghost windows we see during a single ping. Hopefully this will show up in a way that generates automated alerts better than GHOST_WINDOWS. If this works out, I'll make this telemetry measure permanent and remove GHOST_WINDOWS. MozReview-Commit-ID: 11ma1lLGz5L
dom/base/nsWindowMemoryReporter.cpp
toolkit/components/telemetry/Scalars.yaml
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -8,16 +8,17 @@
 #include "nsWindowSizes.h"
 #include "nsGlobalWindow.h"
 #include "nsIDocument.h"
 #include "nsIDOMWindowCollection.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/Telemetry.h"
 #include "nsNetCID.h"
 #include "nsPrintfCString.h"
 #include "XPCJSMemoryReporter.h"
 #include "js/MemoryMetrics.h"
 #include "nsQueryObject.h"
 #include "nsServiceManagerUtils.h"
 #ifdef MOZ_XUL
 #include "nsXULPrototypeCache.h"
@@ -895,16 +896,19 @@ nsWindowMemoryReporter::CheckForGhostWin
         // that is not null.
         mGhostWindowCount++;
         if (aOutGhostIDs && window) {
           aOutGhostIDs->PutEntry(window->WindowID());
         }
       }
     }
   }
+
+  Telemetry::ScalarSetMaximum(Telemetry::ScalarID::MEMORYREPORTER_MAX_GHOST_WINDOWS,
+                              mGhostWindowCount);
 }
 
 /* static */ int64_t
 nsWindowMemoryReporter::GhostWindowsDistinguishedAmount()
 {
   return sWindowReporter->mGhostWindowCount;
 }
 
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -1617,16 +1617,31 @@ browser.errors:
     expires: "64"
     kind: uint
     notification_emails:
       - nightly-js-errors@mozilla.com
       - mkelly@mozilla.com
     record_in_processes:
       - 'main'
 
+# The following section contains memory reporter counters.
+memoryreporter:
+  max_ghost_windows:
+    bug_numbers:
+      - 1454724
+    description: >
+      The maximum number of leaked ghost windows seen.
+    expires: "66"
+    kind: uint
+    notification_emails:
+      - memshrink-telemetry-alerts@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'content'
+
 # The following section is for probes testing the Telemetry system. They will not be
 # submitted in pings and are only used for testing.
 telemetry.test:
   unsigned_int_kind:
     bug_numbers:
       - 1276190
     description: >
       This is a test uint type with a really long description, maybe spanning even multiple