зеркало из https://github.com/mozilla/gecko-dev.git
Bug Bug 1882552 - Add logging to QoS signals r=xpcom-reviewers,barret
Adds logging for Qos overrides, changes, override removals, setting shutdown, and refusing QoS changes due to shutdown. Differential Revision: https://phabricator.services.mozilla.com/D203271
This commit is contained in:
Родитель
177b0c2154
Коммит
54b4354d8e
|
@ -86,6 +86,8 @@ using namespace mozilla::ipc;
|
|||
|
||||
namespace {
|
||||
|
||||
LazyLogModule gQoSLog("QoSPriority"); // For RecvSetMainThreadQoSPriority.
|
||||
|
||||
/* Child process objects */
|
||||
|
||||
class HangMonitorChild : public PProcessHangMonitorChild,
|
||||
|
@ -649,9 +651,21 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvCancelContentJSExecutionIfRunning(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
const char* DefineQoS(const nsIThread::QoSPriority& aQoSPriority) {
|
||||
if (aQoSPriority == nsIThread::QOS_PRIORITY_LOW) {
|
||||
return "BACKGROUND";
|
||||
}
|
||||
// As of right now, all non-low QoS priorities default to the thread's normal
|
||||
// priority.
|
||||
return "NORMAL";
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult HangMonitorChild::RecvSetMainThreadQoSPriority(
|
||||
const nsIThread::QoSPriority& aQoSPriority) {
|
||||
MOZ_RELEASE_ASSERT(IsOnThread());
|
||||
MOZ_LOG(gQoSLog, LogLevel::Debug,
|
||||
("Priority change %s recieved by content process.",
|
||||
DefineQoS(aQoSPriority)));
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// If the new priority is the background (low) priority, we can tell the OS to
|
||||
|
@ -670,14 +684,22 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvSetMainThreadQoSPriority(
|
|||
pthread_override_qos_class_start_np(mMainPThread, qosClass, 0);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||
"HangMonitorChild::RecvSetMainThreadQoSPriority",
|
||||
[qosClass, qosOverride] {
|
||||
[qosClass, qosOverride, aQoSPriority] {
|
||||
MOZ_LOG(
|
||||
gQoSLog, LogLevel::Debug,
|
||||
("Override %s sent to main thread.", DefineQoS(aQoSPriority)));
|
||||
pthread_set_qos_class_self_np(qosClass, 0);
|
||||
if (qosOverride) {
|
||||
pthread_override_qos_class_end_np(qosOverride);
|
||||
MOZ_LOG(gQoSLog, LogLevel::Debug,
|
||||
("Override %s removed from main thread.",
|
||||
DefineQoS(aQoSPriority)));
|
||||
}
|
||||
})))) {
|
||||
// If we fail to dispatch, go ahead and end the override anyway.
|
||||
pthread_override_qos_class_end_np(qosOverride);
|
||||
MOZ_LOG(gQoSLog, LogLevel::Debug,
|
||||
("Override %s removed from main thread.", DefineQoS(aQoSPriority)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче