mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1016629 - c. Add define for ThreadStackHelper pseudostack support; r=snorp
This commit is contained in:
parent
e15783a41a
commit
500bc7575f
@ -76,11 +76,10 @@ ThreadStackHelper::Shutdown()
|
||||
}
|
||||
|
||||
ThreadStackHelper::ThreadStackHelper()
|
||||
:
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
mPseudoStack(mozilla_get_pseudo_stack()),
|
||||
: mStackToFill(nullptr)
|
||||
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
|
||||
, mPseudoStack(mozilla_get_pseudo_stack())
|
||||
#endif
|
||||
mStackToFill(nullptr)
|
||||
, mMaxStackSize(Stack::sMaxInlineStorage)
|
||||
, mMaxBufferSize(0)
|
||||
{
|
||||
@ -196,7 +195,7 @@ ThreadStackHelper::PrepareStackBuffer(Stack& aStack)
|
||||
{
|
||||
// Return false to skip getting the stack and return an empty stack
|
||||
aStack.clear();
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
|
||||
/* Normally, provided the profiler is enabled, it would be an error if we
|
||||
don't have a pseudostack here (the thread probably forgot to call
|
||||
profiler_register_thread). However, on B2G, profiling secondary threads
|
||||
@ -219,7 +218,7 @@ ThreadStackHelper::PrepareStackBuffer(Stack& aStack)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
|
||||
|
||||
namespace {
|
||||
|
||||
@ -287,14 +286,14 @@ ThreadStackHelper::AppendJSEntry(const volatile StackEntry* aEntry,
|
||||
return label;
|
||||
}
|
||||
|
||||
#endif // MOZ_ENABLE_PROFILER_SPS
|
||||
#endif // MOZ_THREADSTACKHELPER_PSEUDO
|
||||
|
||||
void
|
||||
ThreadStackHelper::FillStackBuffer()
|
||||
{
|
||||
MOZ_ASSERT(mStackToFill->empty());
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
|
||||
size_t reservedSize = mStackToFill->capacity();
|
||||
size_t reservedBufferSize = mStackToFill->AvailableBufferSize();
|
||||
intptr_t availableBufferSize = intptr_t(reservedBufferSize);
|
||||
|
@ -23,6 +23,13 @@
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
|
||||
// Support pseudostack on these platforms.
|
||||
#if defined(XP_LINUX) || defined(XP_WIN) || defined(XP_MACOSX)
|
||||
# ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
# define MOZ_THREADSTACKHELPER_PSEUDO
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
@ -41,16 +48,16 @@ public:
|
||||
typedef Telemetry::HangStack Stack;
|
||||
|
||||
private:
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
Stack* mStackToFill;
|
||||
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
|
||||
const PseudoStack* const mPseudoStack;
|
||||
#endif
|
||||
Stack* mStackToFill;
|
||||
size_t mMaxStackSize;
|
||||
size_t mMaxBufferSize;
|
||||
|
||||
bool PrepareStackBuffer(Stack& aStack);
|
||||
void FillStackBuffer();
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
|
||||
const char* AppendJSEntry(const volatile StackEntry* aEntry,
|
||||
intptr_t& aAvailableBufferSize,
|
||||
const char* aPrevLabel);
|
||||
|
Loading…
Reference in New Issue
Block a user