mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Back out 2273e0264d4a (bug 718025) for Windows build failure
This commit is contained in:
parent
9600e90ef3
commit
885c74d009
@ -56,13 +56,6 @@
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
#define USE_NS_STACKWALK
|
||||
#endif
|
||||
#ifdef USE_NS_STACKWALK
|
||||
#include "nsStackWalk.h"
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
using namespace mozilla;
|
||||
|
||||
@ -279,12 +272,7 @@ class TableTicker: public Sampler {
|
||||
{
|
||||
return &mProfile;
|
||||
}
|
||||
|
||||
private:
|
||||
// Not implemented on platforms which do not support backtracing
|
||||
void doBacktrace(Profile &aProfile);
|
||||
|
||||
private:
|
||||
private:
|
||||
Profile mProfile;
|
||||
Stack *mStack;
|
||||
bool mSaveRequested;
|
||||
@ -349,7 +337,8 @@ void TableTicker::HandleSaveRequest()
|
||||
}
|
||||
|
||||
#ifdef USE_BACKTRACE
|
||||
void TableTicker::doBacktrace(Profile &aProfile)
|
||||
static
|
||||
void doBacktrace(Profile &aProfile)
|
||||
{
|
||||
void *array[100];
|
||||
int count = backtrace (array, 100);
|
||||
@ -363,45 +352,6 @@ void TableTicker::doBacktrace(Profile &aProfile)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_NS_STACKWALK
|
||||
typedef struct {
|
||||
void* array[];
|
||||
size_t size;
|
||||
size_t count;
|
||||
} PCArray;
|
||||
|
||||
static
|
||||
void StackWalkCallback(void* aPC, void* aClosure)
|
||||
{
|
||||
PCArray* array = static_cast<PCArray*>(aClosure);
|
||||
if (array->count >= array->size) {
|
||||
// too many frames, ignore
|
||||
return;
|
||||
}
|
||||
array->array[array->count++] = aPC;
|
||||
}
|
||||
|
||||
void TableTicker::doBacktrace(Profile &aProfile)
|
||||
{
|
||||
uintptr_t thread = GetThreadHandle(platform_data());
|
||||
MOZ_ASSERT(thread);
|
||||
void* pc_array[1000];
|
||||
PCArray array = {
|
||||
pc_array,
|
||||
mozilla::ArrayLength(array),
|
||||
0
|
||||
};
|
||||
nsresult rv = NS_StackWalk(StackWalkCallback, 0, &array, thread);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aProfile.addTag(ProfileEntry('s', "XRE_Main", 0));
|
||||
|
||||
for (size_t i = array.count; i > 0; --i) {
|
||||
aProfile.addTag(ProfileEntry('l', (const char*)array.array[i - 1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static
|
||||
void doSampleStackTrace(Stack *aStack, Profile &aProfile, TickSample *sample)
|
||||
{
|
||||
@ -445,7 +395,7 @@ void TableTicker::Tick(TickSample* sample)
|
||||
}
|
||||
|
||||
if (recordSample) {
|
||||
#if defined(USE_BACKTRACE) || defined(USE_NS_STACKWALK)
|
||||
#ifdef USE_BACKTRACE
|
||||
if (mUseStackWalk) {
|
||||
doBacktrace(mProfile);
|
||||
} else {
|
||||
|
@ -33,11 +33,6 @@ class Sampler::PlatformData : public Malloced {
|
||||
HANDLE profiled_thread_;
|
||||
};
|
||||
|
||||
uintptr_t
|
||||
Sampler::GetThreadHandle(Sampler::PlatformData* aData)
|
||||
{
|
||||
return (uintptr_t) aData->profiled_thread();
|
||||
}
|
||||
|
||||
class SamplerThread : public Thread {
|
||||
public:
|
||||
|
@ -203,11 +203,6 @@ class Sampler {
|
||||
|
||||
PlatformData* platform_data() { return data_; }
|
||||
|
||||
#ifdef XP_WIN
|
||||
// xxxehsan sucky hack :(
|
||||
static uintptr_t GetThreadHandle(PlatformData*);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void SetActive(bool value) { NoBarrier_Store(&active_, value); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user