mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Backed out changeset fddfc0739043 (bug 1312883)
This commit is contained in:
parent
76ef49dbdd
commit
783a571c6e
@ -283,7 +283,7 @@ HangMonitorChild::HangMonitorChild(ProcessHangMonitor* aMonitor)
|
||||
mForcePaintMonitor =
|
||||
MakeUnique<mozilla::BackgroundHangMonitor>("Gecko_Child_ForcePaint",
|
||||
128, /* ms timeout for microhangs */
|
||||
1024, /* ms timeout for permahangs */
|
||||
8192 /* ms timeout for permahangs */,
|
||||
BackgroundHangMonitor::THREAD_PRIVATE);
|
||||
}
|
||||
|
||||
|
@ -2079,18 +2079,9 @@ CreateJSHangHistogram(JSContext* cx, const Telemetry::HangHistogram& hang)
|
||||
}
|
||||
|
||||
if (!hang.GetNativeStack().empty()) {
|
||||
const Telemetry::HangStack& stack = hang.GetNativeStack();
|
||||
const std::vector<uintptr_t>& frames = stack.GetNativeFrames();
|
||||
Telemetry::ProcessedStack processed = Telemetry::GetStackAndModules(frames);
|
||||
|
||||
CombinedStacks singleStack;
|
||||
singleStack.AddStack(processed);
|
||||
JS::RootedObject fullReportObj(cx, CreateJSStackObject(cx, singleStack));
|
||||
if (!fullReportObj) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!JS_DefineProperty(cx, ret, "nativeStack", fullReportObj, JSPROP_ENUMERATE)) {
|
||||
JS::RootedObject native(cx, CreateJSHangStack(cx, hang.GetNativeStack()));
|
||||
if (!native ||
|
||||
!JS_DefineProperty(cx, ret, "nativeStack", native, JSPROP_ENUMERATE)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,6 @@ class HangStack
|
||||
{
|
||||
public:
|
||||
static const size_t sMaxInlineStorage = 8;
|
||||
// The maximum depth for the native stack frames that we might collect.
|
||||
static const size_t sMaxNativeFrames = 25;
|
||||
|
||||
private:
|
||||
typedef mozilla::Vector<const char*, sMaxInlineStorage> Impl;
|
||||
@ -61,14 +59,9 @@ private:
|
||||
// Stack entries can either be a static const char*
|
||||
// or a pointer to within this buffer.
|
||||
mozilla::Vector<char, 0> mBuffer;
|
||||
// When a native stack is gathered, this vector holds the raw program counter
|
||||
// values that MozStackWalk will return to us after it walks the stack.
|
||||
// When gathering the Telemetry payload, Telemetry will take care of mapping
|
||||
// these program counters to proper addresses within modules.
|
||||
std::vector<uintptr_t> mNativeFrames;
|
||||
|
||||
public:
|
||||
HangStack() {}
|
||||
HangStack() { }
|
||||
|
||||
HangStack(HangStack&& aOther)
|
||||
: mImpl(mozilla::Move(aOther.mImpl))
|
||||
@ -118,7 +111,6 @@ public:
|
||||
void clear() {
|
||||
mImpl.clear();
|
||||
mBuffer.clear();
|
||||
mNativeFrames.clear();
|
||||
}
|
||||
|
||||
bool IsInBuffer(const char* aEntry) const {
|
||||
@ -144,21 +136,6 @@ public:
|
||||
|
||||
const char* InfallibleAppendViaBuffer(const char* aText, size_t aLength);
|
||||
const char* AppendViaBuffer(const char* aText, size_t aLength);
|
||||
|
||||
void EnsureNativeFrameCapacity(size_t aCapacity) {
|
||||
mNativeFrames.reserve(aCapacity);
|
||||
}
|
||||
|
||||
void AppendNativeFrame(uintptr_t aPc) {
|
||||
MOZ_ASSERT(mNativeFrames.size() <= sMaxNativeFrames);
|
||||
if (mNativeFrames.size() < sMaxNativeFrames) {
|
||||
mNativeFrames.push_back(aPc);
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<uintptr_t>& GetNativeFrames() const {
|
||||
return mNativeFrames;
|
||||
}
|
||||
};
|
||||
|
||||
/* A hang histogram consists of a stack associated with the
|
||||
|
@ -162,12 +162,6 @@ public:
|
||||
|
||||
void
|
||||
ThreadStackHelper::GetStack(Stack& aStack)
|
||||
{
|
||||
GetStackInternal(aStack, /* aAppendNativeStack */ false);
|
||||
}
|
||||
|
||||
void
|
||||
ThreadStackHelper::GetStackInternal(Stack& aStack, bool aAppendNativeStack)
|
||||
{
|
||||
// Always run PrepareStackBuffer first to clear aStack
|
||||
if (!PrepareStackBuffer(aStack)) {
|
||||
@ -201,13 +195,6 @@ ThreadStackHelper::GetStackInternal(Stack& aStack, bool aAppendNativeStack)
|
||||
MOZ_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
#ifdef _WIN64
|
||||
AcquireStackWalkWorkaroundLock();
|
||||
#endif
|
||||
if (aAppendNativeStack) {
|
||||
aStack.EnsureNativeFrameCapacity(Telemetry::HangStack::sMaxNativeFrames);
|
||||
}
|
||||
|
||||
if (::SuspendThread(mThreadID) == DWORD(-1)) {
|
||||
MOZ_ASSERT(false);
|
||||
return;
|
||||
@ -222,22 +209,6 @@ ThreadStackHelper::GetStackInternal(Stack& aStack, bool aAppendNativeStack)
|
||||
FillStackBuffer();
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
ReleaseStackWalkWorkaroundLock();
|
||||
#endif
|
||||
|
||||
if (aAppendNativeStack) {
|
||||
auto callback = [](uint32_t, void* aPC, void*, void* aClosure) {
|
||||
Stack* stack = static_cast<Stack*>(aClosure);
|
||||
stack->AppendNativeFrame(reinterpret_cast<uintptr_t>(aPC));
|
||||
};
|
||||
|
||||
MozStackWalk(callback, /* skipFrames */ 0,
|
||||
/* maxFrames */ Telemetry::HangStack::sMaxNativeFrames,
|
||||
reinterpret_cast<void*>(&aStack),
|
||||
reinterpret_cast<uintptr_t>(mThreadID), nullptr);
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_TRUE(::ResumeThread(mThreadID) != DWORD(-1));
|
||||
|
||||
#elif defined(XP_MACOSX)
|
||||
@ -265,7 +236,10 @@ void
|
||||
ThreadStackHelper::GetNativeStack(Stack& aStack)
|
||||
{
|
||||
#ifdef MOZ_THREADSTACKHELPER_NATIVE
|
||||
GetStackInternal(aStack, /* aAppendNativeStack */ true);
|
||||
// Get pseudostack first and fill the thread context.
|
||||
GetStack(aStack);
|
||||
|
||||
// TODO: walk the saved stack frames.
|
||||
#endif // MOZ_THREADSTACKHELPER_NATIVE
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,6 @@ public:
|
||||
*/
|
||||
void GetNativeStack(Stack& aStack);
|
||||
|
||||
private:
|
||||
void GetStackInternal(Stack& aStack, bool aAppendNativeStack);
|
||||
#if defined(XP_LINUX)
|
||||
private:
|
||||
static int sInitialized;
|
||||
|
Loading…
Reference in New Issue
Block a user