зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1328378 (part 4) - Remove sample_obj. r=mstange.
It's silly indirection. --HG-- extra : rebase_source : 6eb2f7c13d689db57e604f871372e98d06fea5a1
This commit is contained in:
Родитель
c1b1bc70df
Коммит
54ff9e9a14
|
@ -181,18 +181,17 @@ SigprofHandler(int signal, siginfo_t* info, void* context)
|
||||||
// Avoid TSan warning about clobbering errno.
|
// Avoid TSan warning about clobbering errno.
|
||||||
int savedErrno = errno;
|
int savedErrno = errno;
|
||||||
|
|
||||||
TickSample sample_obj;
|
TickSample sample;
|
||||||
TickSample* sample = &sample_obj;
|
sample.context = context;
|
||||||
sample->context = context;
|
|
||||||
|
|
||||||
// Extract the current pc and sp.
|
// Extract the current pc and sp.
|
||||||
SetSampleContext(sample, context);
|
SetSampleContext(&sample, context);
|
||||||
sample->threadInfo = gCurrentThreadInfo;
|
sample.threadInfo = gCurrentThreadInfo;
|
||||||
sample->timestamp = mozilla::TimeStamp::Now();
|
sample.timestamp = mozilla::TimeStamp::Now();
|
||||||
sample->rssMemory = gRssMemory;
|
sample.rssMemory = gRssMemory;
|
||||||
sample->ussMemory = gUssMemory;
|
sample.ussMemory = gUssMemory;
|
||||||
|
|
||||||
Tick(sample);
|
Tick(&sample);
|
||||||
|
|
||||||
sem_post(&gSignalHandlingDone);
|
sem_post(&gSignalHandlingDone);
|
||||||
errno = savedErrno;
|
errno = savedErrno;
|
||||||
|
|
|
@ -190,15 +190,14 @@ public:
|
||||||
thread_act_t profiled_thread =
|
thread_act_t profiled_thread =
|
||||||
aThreadInfo->GetPlatformData()->profiled_thread();
|
aThreadInfo->GetPlatformData()->profiled_thread();
|
||||||
|
|
||||||
TickSample sample_obj;
|
TickSample sample;
|
||||||
TickSample* sample = &sample_obj;
|
|
||||||
|
|
||||||
// Unique Set Size is not supported on Mac.
|
// Unique Set Size is not supported on Mac.
|
||||||
sample->ussMemory = 0;
|
sample.ussMemory = 0;
|
||||||
sample->rssMemory = 0;
|
sample.rssMemory = 0;
|
||||||
|
|
||||||
if (isFirstProfiledThread && gProfileMemory) {
|
if (isFirstProfiledThread && gProfileMemory) {
|
||||||
sample->rssMemory = nsMemoryReporterManager::ResidentFast();
|
sample.rssMemory = nsMemoryReporterManager::ResidentFast();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're using thread_suspend on OS X because pthread_kill (which is what
|
// We're using thread_suspend on OS X because pthread_kill (which is what
|
||||||
|
@ -233,15 +232,15 @@ public:
|
||||||
flavor,
|
flavor,
|
||||||
reinterpret_cast<natural_t*>(&state),
|
reinterpret_cast<natural_t*>(&state),
|
||||||
&count) == KERN_SUCCESS) {
|
&count) == KERN_SUCCESS) {
|
||||||
sample->pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip));
|
sample.pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip));
|
||||||
sample->sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp));
|
sample.sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp));
|
||||||
sample->fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp));
|
sample.fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp));
|
||||||
sample->timestamp = mozilla::TimeStamp::Now();
|
sample.timestamp = mozilla::TimeStamp::Now();
|
||||||
sample->threadInfo = aThreadInfo;
|
sample.threadInfo = aThreadInfo;
|
||||||
|
|
||||||
#undef REGISTER_FIELD
|
#undef REGISTER_FIELD
|
||||||
|
|
||||||
Tick(sample);
|
Tick(&sample);
|
||||||
}
|
}
|
||||||
thread_resume(profiled_thread);
|
thread_resume(profiled_thread);
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,21 +202,20 @@ class SamplerThread
|
||||||
CONTEXT context;
|
CONTEXT context;
|
||||||
memset(&context, 0, sizeof(context));
|
memset(&context, 0, sizeof(context));
|
||||||
|
|
||||||
TickSample sample_obj;
|
TickSample sample;
|
||||||
TickSample* sample = &sample_obj;
|
|
||||||
|
|
||||||
// Grab the timestamp before pausing the thread, to avoid deadlocks.
|
// Grab the timestamp before pausing the thread, to avoid deadlocks.
|
||||||
sample->timestamp = mozilla::TimeStamp::Now();
|
sample.timestamp = mozilla::TimeStamp::Now();
|
||||||
sample->threadInfo = aThreadInfo;
|
sample.threadInfo = aThreadInfo;
|
||||||
|
|
||||||
if (isFirstProfiledThread && gProfileMemory) {
|
if (isFirstProfiledThread && gProfileMemory) {
|
||||||
sample->rssMemory = nsMemoryReporterManager::ResidentFast();
|
sample.rssMemory = nsMemoryReporterManager::ResidentFast();
|
||||||
} else {
|
} else {
|
||||||
sample->rssMemory = 0;
|
sample.rssMemory = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unique Set Size is not supported on Windows.
|
// Unique Set Size is not supported on Windows.
|
||||||
sample->ussMemory = 0;
|
sample.ussMemory = 0;
|
||||||
|
|
||||||
static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
|
static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
|
||||||
if (SuspendThread(profiled_thread) == kSuspendFailed)
|
if (SuspendThread(profiled_thread) == kSuspendFailed)
|
||||||
|
@ -239,18 +238,18 @@ class SamplerThread
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GP_ARCH_amd64)
|
#if defined(GP_ARCH_amd64)
|
||||||
sample->pc = reinterpret_cast<Address>(context.Rip);
|
sample.pc = reinterpret_cast<Address>(context.Rip);
|
||||||
sample->sp = reinterpret_cast<Address>(context.Rsp);
|
sample.sp = reinterpret_cast<Address>(context.Rsp);
|
||||||
sample->fp = reinterpret_cast<Address>(context.Rbp);
|
sample.fp = reinterpret_cast<Address>(context.Rbp);
|
||||||
#else
|
#else
|
||||||
sample->pc = reinterpret_cast<Address>(context.Eip);
|
sample.pc = reinterpret_cast<Address>(context.Eip);
|
||||||
sample->sp = reinterpret_cast<Address>(context.Esp);
|
sample.sp = reinterpret_cast<Address>(context.Esp);
|
||||||
sample->fp = reinterpret_cast<Address>(context.Ebp);
|
sample.fp = reinterpret_cast<Address>(context.Ebp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sample->context = &context;
|
sample.context = &context;
|
||||||
|
|
||||||
Tick(sample);
|
Tick(&sample);
|
||||||
|
|
||||||
ResumeThread(profiled_thread);
|
ResumeThread(profiled_thread);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче