gecko-dev/xpcom/threads/moz.build
Doug Thayer 8aae071723 Bug 1382440 - Watch CPU usage in BHR r=froydnj
We would like to be able to see if a given hang in BHR occurred
under high CPU load, as this is an indication that the hang is
of less use to us, since it's likely that the external CPU use
is more responsible for it.

The way this works is fairly simple. We get the system CPU usage
on a scale from 0 to 1, and we get the current process's CPU
usage, also on a scale from 0 to 1, and we subtract the latter
from the former. We then compare this value to a threshold, which
is 1 - (1 / p), where p is the number of (virtual) cores on the
machine. This threshold might need to be tuned, so that we
require an entire physical core in order to not annotate the hang,
but for now it seemed the most reasonable line in the sand.

I should note that this considers CPU usage in child or parent
processes as external. While we are responsible for that CPU usage,
it still indicates that the stack we receive from BHR is of little
value to us, since the source of the actual hang is external to
that stack.

MozReview-Commit-ID: JkG53zq1MdY

--HG--
extra : rebase_source : 16553a9b5eac0a73cd1619c6ee01fa177ca60e58
2017-07-24 13:46:09 -07:00

122 lines
2.7 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsIEnvironment.idl',
'nsIEventTarget.idl',
'nsIIdlePeriod.idl',
'nsINamed.idl',
'nsIProcess.idl',
'nsIRunnable.idl',
'nsISerialEventTarget.idl',
'nsISupportsPriority.idl',
'nsIThread.idl',
'nsIThreadInternal.idl',
'nsIThreadManager.idl',
'nsIThreadPool.idl',
'nsITimer.idl',
]
XPIDL_MODULE = 'xpcom_threads'
EXPORTS += [
'MainThreadUtils.h',
'nsICancelableRunnable.h',
'nsIIdleRunnable.h',
'nsILabelableRunnable.h',
'nsMemoryPressure.h',
'nsProcess.h',
'nsProxyRelease.h',
'nsThread.h',
'nsThreadUtils.h',
]
EXPORTS.mozilla += [
'AbstractEventQueue.h',
'AbstractThread.h',
'BlockingResourceBase.h',
'CondVar.h',
'CooperativeThreadPool.h',
'CPUUsageWatcher.h',
'DeadlockDetector.h',
'EventQueue.h',
'HangAnnotations.h',
'HangMonitor.h',
'IdleTaskRunner.h',
'LazyIdleThread.h',
'MainThreadIdlePeriod.h',
'Monitor.h',
'MozPromise.h',
'Mutex.h',
'Queue.h',
'RecursiveMutex.h',
'ReentrantMonitor.h',
'RWLock.h',
'Scheduler.h',
'SchedulerGroup.h',
'SharedThreadPool.h',
'StateMirroring.h',
'StateWatching.h',
'SynchronizedEventQueue.h',
'SyncRunnable.h',
'SystemGroup.h',
'TaskCategory.h',
'TaskDispatcher.h',
'TaskQueue.h',
'ThreadEventQueue.h',
'ThrottledEventQueue.h',
]
SOURCES += [
'IdleTaskRunner.cpp',
]
UNIFIED_SOURCES += [
'AbstractThread.cpp',
'BlockingResourceBase.cpp',
'CooperativeThreadPool.cpp',
'CPUUsageWatcher.cpp',
'EventQueue.cpp',
'HangAnnotations.cpp',
'HangMonitor.cpp',
'InputEventStatistics.cpp',
'LabeledEventQueue.cpp',
'LazyIdleThread.cpp',
'MainThreadIdlePeriod.cpp',
'nsEnvironment.cpp',
'nsMemoryPressure.cpp',
'nsProcessCommon.cpp',
'nsProxyRelease.cpp',
'nsThread.cpp',
'nsThreadManager.cpp',
'nsThreadPool.cpp',
'nsThreadUtils.cpp',
'nsTimerImpl.cpp',
'PrioritizedEventQueue.cpp',
'RecursiveMutex.cpp',
'RWLock.cpp',
'Scheduler.cpp',
'SchedulerGroup.cpp',
'SharedThreadPool.cpp',
'SynchronizedEventQueue.cpp',
'SystemGroup.cpp',
'TaskQueue.cpp',
'ThreadEventQueue.cpp',
'ThreadEventTarget.cpp',
'ThrottledEventQueue.cpp',
'TimerThread.cpp',
]
LOCAL_INCLUDES += [
'../build',
'/caps',
'/tools/profiler',
]
FINAL_LIBRARY = 'xul'
include('/ipc/chromium/chromium-config.mozbuild')