Bug 1228437 - Add BHR stats from e10s child process. B2G fix by Ting-Yu Chou. r=nchen

This commit is contained in:
Vladan Djeric 2015-12-26 19:34:11 -05:00
parent 3c0357ee8a
commit 49afd313a4
2 changed files with 25 additions and 8 deletions

View File

@ -521,12 +521,16 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
sExitManager = new AtExitManager();
}
if (!MessageLoop::current()) {
MessageLoop* messageLoop = MessageLoop::current();
if (!messageLoop) {
sMessageLoop = new MessageLoopForUI(MessageLoop::TYPE_MOZILLA_UI);
sMessageLoop->set_thread_name("Gecko");
// Set experimental values for main thread hangs:
// 128ms for transient hangs and 8192ms for permanent hangs
sMessageLoop->set_hang_timeouts(128, 8192);
} else if (messageLoop->type() == MessageLoop::TYPE_MOZILLA_CHILD) {
messageLoop->set_thread_name("Gecko_Child");
messageLoop->set_hang_timeouts(128, 8192);
}
if (XRE_IsParentProcess() &&

View File

@ -23,6 +23,10 @@
#include "nsExceptionHandler.h"
#endif
#ifdef MOZ_NUWA_PROCESS
#include "ipc/Nuwa.h"
#endif
#ifdef XP_WIN
#include <windows.h>
#endif
@ -109,8 +113,12 @@ Crash()
#endif
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Hang"),
NS_LITERAL_CSTRING("1"));
// If you change this, you must also deal with the threadsafety of AnnotateCrashReport in
// non-chrome processes!
if (GeckoProcessType_Default == XRE_GetProcessType()) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Hang"),
NS_LITERAL_CSTRING("1"));
}
#endif
NS_RUNTIMEABORT("HangMonitor triggered");
@ -176,6 +184,12 @@ ThreadMain(void*)
{
PR_SetCurrentThreadName("Hang Monitor");
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
NuwaMarkCurrentThread(nullptr, nullptr);
}
#endif
MonitorAutoLock lock(*gMonitor);
// In order to avoid issues with the hang monitor incorrectly triggering
@ -256,10 +270,8 @@ ThreadMain(void*)
void
Startup()
{
// The hang detector only runs in chrome processes. If you change this,
// you must also deal with the threadsafety of AnnotateCrashReport in
// non-chrome processes!
if (GeckoProcessType_Default != XRE_GetProcessType()) {
if (GeckoProcessType_Default != XRE_GetProcessType() &&
GeckoProcessType_Content != XRE_GetProcessType()) {
return;
}
@ -293,7 +305,8 @@ Startup()
void
Shutdown()
{
if (GeckoProcessType_Default != XRE_GetProcessType()) {
if (GeckoProcessType_Default != XRE_GetProcessType() &&
GeckoProcessType_Content != XRE_GetProcessType()) {
return;
}