Bug 1034138 - a. Get native stack for permahangs in BHM; r=snorp

This commit is contained in:
Jim Chen 2014-07-24 22:33:49 -04:00
parent 07a5dc2fb3
commit 8168e91f41

View File

@ -147,7 +147,7 @@ public:
uint32_t aMaxTimeoutMs);
// Report a hang; aManager->mLock IS locked
void ReportHang(PRIntervalTime aHangTime);
Telemetry::HangHistogram& ReportHang(PRIntervalTime aHangTime);
// Report a permanent hang; aManager->mLock IS locked
void ReportPermaHang();
// Called by BackgroundHangMonitor::NotifyActivity
@ -354,7 +354,7 @@ BackgroundHangThread::~BackgroundHangThread()
Telemetry::RecordThreadHangStats(mStats);
}
void
Telemetry::HangHistogram&
BackgroundHangThread::ReportHang(PRIntervalTime aHangTime)
{
// Recovered from a hang; called on the monitor thread
@ -366,12 +366,13 @@ BackgroundHangThread::ReportHang(PRIntervalTime aHangTime)
if (newHistogram == *oldHistogram) {
// New histogram matches old one
oldHistogram->Add(aHangTime);
return;
return *oldHistogram;
}
}
// Add new histogram
newHistogram.Add(aHangTime);
mStats.mHangs.append(Move(newHistogram));
return mStats.mHangs.back();
}
void
@ -380,8 +381,11 @@ BackgroundHangThread::ReportPermaHang()
// Permanently hanged; called on the monitor thread
// mManager->mLock IS locked
// TODO: Add more detailed analysis for perma-hangs
ReportHang(mMaxTimeout);
Telemetry::HangHistogram& hang = ReportHang(mMaxTimeout);
Telemetry::HangStack& stack = hang.GetNativeStack();
if (stack.empty()) {
mStackHelper.GetNativeStack(stack);
}
}
MOZ_ALWAYS_INLINE void