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
--- 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