Skip to content

Commit

Permalink
Bug 1538987 - Collect Telemetry on process priority switching. data-r…
Browse files Browse the repository at this point in the history
…eview=chutten, r=gsvelto

Differential Revision: https://phabricator.services.mozilla.com/D25137

--HG--
extra : moz-landing-system : lando
  • Loading branch information
mikeconley committed Mar 28, 2019
1 parent d87f68a commit aacf5c1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dom/ipc/ProcessPriorityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
#include "mozilla/Logging.h"
#include "nsPrintfCString.h"
Expand Down Expand Up @@ -493,6 +494,9 @@ void ProcessPriorityManagerImpl::TabActivityChanged(TabParent* aTabParent,
return;
}

Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_CHANGE_CONSIDERED, 1);

pppm->TabActivityChanged(aTabParent, aIsActive);
}

Expand Down Expand Up @@ -795,6 +799,15 @@ void ParticularProcessPriorityManager::SetPriorityNow(
ProcessPriority oldPriority = mPriority;

mPriority = aPriority;

if (oldPriority < mPriority) {
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_RAISED, 1);
} else {
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_LOWERED, 1);
}

hal::SetProcessPriority(Pid(), mPriority);

if (oldPriority != mPriority) {
Expand Down
43 changes: 43 additions & 0 deletions toolkit/components/telemetry/Scalars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,49 @@ dom.contentprocess:
release_channel_collection: opt-out
record_in_processes:
- 'main'
os_priority_lowered:
bug_numbers:
- 1538987
description: >
The number of times a content process has had its OS priority lowered
due to only containing background tabs without audible media playing.
expires: never
kind: uint
notification_emails:
- [email protected]
- [email protected]
release_channel_collection: opt-out
record_in_processes:
- 'main'
os_priority_raised:
bug_numbers:
- 1538987
description: >
The number of times a content process has had its OS priority raised
due to containing at least one foregrounded tab, or a tab with audible
media has started playing in it.
expires: never
kind: uint
notification_emails:
- [email protected]
- [email protected]
release_channel_collection: opt-out
record_in_processes:
- 'main'
os_priority_change_considered:
bug_numbers:
- 1538987
description: >
The number of times we've had the opportunity to change content process
priority due to a tab switch or a tab being opened.
expires: never
kind: uint
notification_emails:
- [email protected]
- [email protected]
release_channel_collection: opt-out
record_in_processes:
- 'main'

# The following section contains parent process base counters.
dom.parentprocess:
Expand Down

0 comments on commit aacf5c1

Please sign in to comment.