Bug 1251667 - Add a measure SLOW_SCRIPT_PAGE_COUNT, which measures the number of pages per session that have slow scripts. r=wmccloskey

Slow script events are when the script hangs the page's process (that's the content process on e10s).

For further reference, see https://wiki.mozilla.org/Electrolysis/Release_Criteria/Slow_Script. The measure is necessary because SLOW_SCRIPT_NOTICE_COUNT is not comparable between e10s and non-e10s, while SLOW_SCRIPT_PAGE_COUNT will be. This is necessary for evaluating the slow script e10s release criteria.

The measure requires a new field in nsGlobalWindow because we need to keep track of when the page changes in order to know whether we need to count a slow script event. This is a relatively clean option compared to keeping track of that state in XPCJSRuntime or dom::Navigator.
This commit is contained in:
Anthony Zhang 2016-03-01 11:16:33 -05:00
parent 0d397393e7
commit aa38988192
3 changed files with 20 additions and 0 deletions

View File

@ -1158,6 +1158,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mIsPopupSpam(false),
mBlockScriptedClosingFlag(false),
mWasOffline(false),
mHasHadSlowScript(false),
mNotifyIdleObserversIdleOnThaw(false),
mNotifyIdleObserversActiveOnThaw(false),
mCreatingInnerWindow(false),
@ -10662,6 +10663,13 @@ nsGlobalWindow::ShowSlowScriptDialog()
unsigned lineno;
bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno);
// Record the slow script event if we haven't done so already for this inner window
// (which represents a particular page to the user).
if (!mHasHadSlowScript) {
Telemetry::Accumulate(Telemetry::SLOW_SCRIPT_PAGE_COUNT, 1);
}
mHasHadSlowScript = true;
if (XRE_IsContentProcess() &&
ProcessHangMonitor::Get()) {
ProcessHangMonitor::SlowScriptAction action;

View File

@ -1691,6 +1691,11 @@ protected:
// Window offline status. Checked to see if we need to fire offline event
bool mWasOffline : 1;
// Represents whether the inner window's page has had a slow script notice.
// Only used by inner windows; will always be false for outer windows.
// This is used to implement Telemetry measures such as SLOW_SCRIPT_PAGE_COUNT.
bool mHasHadSlowScript : 1;
// Track what sorts of events we need to fire when thawed
bool mNotifyIdleObserversIdleOnThaw : 1;
bool mNotifyIdleObserversActiveOnThaw : 1;

View File

@ -9019,6 +9019,13 @@
"kind": "count",
"description": "Count slow script notices"
},
"SLOW_SCRIPT_PAGE_COUNT": {
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
"expires_in_version": "never",
"kind": "count",
"bug_numbers": [1251667],
"description": "The number of pages that trigger slow script notices"
},
"PLUGIN_HANG_NOTICE_COUNT": {
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
"expires_in_version": "never",