Fix DevTools CPU profiler after isolates merge.
There was an obvious bug with missing call to SamplerRegistry::GetState. I've also updated CpuProfiler to avoid stopping sampler, if it didn't started it. R=vitalyr@chromium.org BUG=none TEST=none Review URL: http://codereview.chromium.org/6712062 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7293 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
12615106d7
commit
d98baf8098
@ -441,6 +441,7 @@ CpuProfiler::CpuProfiler()
|
|||||||
token_enumerator_(new TokenEnumerator()),
|
token_enumerator_(new TokenEnumerator()),
|
||||||
generator_(NULL),
|
generator_(NULL),
|
||||||
processor_(NULL),
|
processor_(NULL),
|
||||||
|
need_to_stop_sampler_(false),
|
||||||
is_profiling_(false) {
|
is_profiling_(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +487,10 @@ void CpuProfiler::StartProcessorIfNotStarted() {
|
|||||||
}
|
}
|
||||||
// Enable stack sampling.
|
// Enable stack sampling.
|
||||||
Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
|
Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
|
||||||
if (!sampler->IsActive()) sampler->Start();
|
if (!sampler->IsActive()) {
|
||||||
|
sampler->Start();
|
||||||
|
need_to_stop_sampler_ = true;
|
||||||
|
}
|
||||||
sampler->IncreaseProfilingDepth();
|
sampler->IncreaseProfilingDepth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,7 +524,10 @@ void CpuProfiler::StopProcessorIfLastProfile(const char* title) {
|
|||||||
if (profiles_->IsLastProfile(title)) {
|
if (profiles_->IsLastProfile(title)) {
|
||||||
Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
|
Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
|
||||||
sampler->DecreaseProfilingDepth();
|
sampler->DecreaseProfilingDepth();
|
||||||
sampler->Stop();
|
if (need_to_stop_sampler_) {
|
||||||
|
sampler->Stop();
|
||||||
|
need_to_stop_sampler_ = false;
|
||||||
|
}
|
||||||
processor_->Stop();
|
processor_->Stop();
|
||||||
processor_->Join();
|
processor_->Join();
|
||||||
delete processor_;
|
delete processor_;
|
||||||
|
@ -283,6 +283,7 @@ class CpuProfiler {
|
|||||||
ProfileGenerator* generator_;
|
ProfileGenerator* generator_;
|
||||||
ProfilerEventsProcessor* processor_;
|
ProfilerEventsProcessor* processor_;
|
||||||
int saved_logging_nesting_;
|
int saved_logging_nesting_;
|
||||||
|
bool need_to_stop_sampler_;
|
||||||
Atomic32 is_profiling_;
|
Atomic32 is_profiling_;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -927,8 +927,9 @@ class SignalSender : public Thread {
|
|||||||
|
|
||||||
// Implement Thread::Run().
|
// Implement Thread::Run().
|
||||||
virtual void Run() {
|
virtual void Run() {
|
||||||
SamplerRegistry::State state = SamplerRegistry::GetState();
|
SamplerRegistry::State state;
|
||||||
while (state != SamplerRegistry::HAS_NO_SAMPLERS) {
|
while ((state = SamplerRegistry::GetState()) !=
|
||||||
|
SamplerRegistry::HAS_NO_SAMPLERS) {
|
||||||
bool cpu_profiling_enabled =
|
bool cpu_profiling_enabled =
|
||||||
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
|
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
|
||||||
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
|
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
|
||||||
|
@ -663,8 +663,9 @@ class SamplerThread : public Thread {
|
|||||||
|
|
||||||
// Implement Thread::Run().
|
// Implement Thread::Run().
|
||||||
virtual void Run() {
|
virtual void Run() {
|
||||||
SamplerRegistry::State state = SamplerRegistry::GetState();
|
SamplerRegistry::State state;
|
||||||
while (state != SamplerRegistry::HAS_NO_SAMPLERS) {
|
while ((state = SamplerRegistry::GetState()) !=
|
||||||
|
SamplerRegistry::HAS_NO_SAMPLERS) {
|
||||||
bool cpu_profiling_enabled =
|
bool cpu_profiling_enabled =
|
||||||
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
|
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
|
||||||
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
|
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
|
||||||
@ -684,7 +685,6 @@ class SamplerThread : public Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OS::Sleep(interval_);
|
OS::Sleep(interval_);
|
||||||
state = SamplerRegistry::GetState();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1914,8 +1914,9 @@ class SamplerThread : public Thread {
|
|||||||
|
|
||||||
// Implement Thread::Run().
|
// Implement Thread::Run().
|
||||||
virtual void Run() {
|
virtual void Run() {
|
||||||
SamplerRegistry::State state = SamplerRegistry::GetState();
|
SamplerRegistry::State state;
|
||||||
while (state != SamplerRegistry::HAS_NO_SAMPLERS) {
|
while ((state = SamplerRegistry::GetState()) !=
|
||||||
|
SamplerRegistry::HAS_NO_SAMPLERS) {
|
||||||
bool cpu_profiling_enabled =
|
bool cpu_profiling_enabled =
|
||||||
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
|
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
|
||||||
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
|
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
|
||||||
|
Loading…
Reference in New Issue
Block a user