Bug 942488 - Don't report pseudo-stacks without SPS profiler. r=nchen

This commit is contained in:
Jan Beich 2013-11-25 09:24:00 -05:00
parent 5cd1075cce
commit b25abb6817
2 changed files with 13 additions and 2 deletions

View File

@ -50,8 +50,11 @@ ThreadStackHelper::Shutdown()
}
ThreadStackHelper::ThreadStackHelper()
: mPseudoStack(mozilla_get_pseudo_stack())
, mStackBuffer()
:
#ifdef MOZ_ENABLE_PROFILER_SPS
mPseudoStack(mozilla_get_pseudo_stack()),
#endif
mStackBuffer()
, mMaxStackSize(mStackBuffer.capacity())
{
#if defined(XP_LINUX)
@ -147,15 +150,20 @@ ThreadStackHelper::SigAction(int aSignal, siginfo_t* aInfo, void* aContext)
bool
ThreadStackHelper::PrepareStackBuffer(Stack& aStack) {
aStack.clear();
#ifdef MOZ_ENABLE_PROFILER_SPS
if (!mPseudoStack) {
return false;
}
mStackBuffer.clear();
return mStackBuffer.reserve(mMaxStackSize);
#else
return false;
#endif
}
void
ThreadStackHelper::FillStackBuffer() {
#ifdef MOZ_ENABLE_PROFILER_SPS
size_t reservedSize = mMaxStackSize;
// Go from front to back
@ -170,6 +178,7 @@ ThreadStackHelper::FillStackBuffer() {
}
// If we exited early due to buffer size, expand the buffer for next time
mMaxStackSize += (end - entry);
#endif
}
} // namespace mozilla

View File

@ -40,7 +40,9 @@ public:
typedef Telemetry::HangHistogram::Stack Stack;
private:
#ifdef MOZ_ENABLE_PROFILER_SPS
const PseudoStack* const mPseudoStack;
#endif
Stack mStackBuffer;
size_t mMaxStackSize;