Revision: 7293
Author: [email protected]
Date: Mon Mar 21 10:40:40 2011
Log: 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.
[email protected]
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6712062
http://code.google.com/p/v8/source/detail?r=7293
Modified:
/branches/bleeding_edge/src/cpu-profiler.cc
/branches/bleeding_edge/src/cpu-profiler.h
/branches/bleeding_edge/src/platform-linux.cc
/branches/bleeding_edge/src/platform-macos.cc
/branches/bleeding_edge/src/platform-win32.cc
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/cpu-profiler.cc Mon Mar 21 10:40:40 2011
@@ -441,6 +441,7 @@
token_enumerator_(new TokenEnumerator()),
generator_(NULL),
processor_(NULL),
+ need_to_stop_sampler_(false),
is_profiling_(false) {
}
@@ -486,7 +487,10 @@
}
// Enable stack sampling.
Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
- if (!sampler->IsActive()) sampler->Start();
+ if (!sampler->IsActive()) {
+ sampler->Start();
+ need_to_stop_sampler_ = true;
+ }
sampler->IncreaseProfilingDepth();
}
}
@@ -520,7 +524,10 @@
if (profiles_->IsLastProfile(title)) {
Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
sampler->DecreaseProfilingDepth();
- sampler->Stop();
+ if (need_to_stop_sampler_) {
+ sampler->Stop();
+ need_to_stop_sampler_ = false;
+ }
processor_->Stop();
processor_->Join();
delete processor_;
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.h Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/cpu-profiler.h Mon Mar 21 10:40:40 2011
@@ -283,6 +283,7 @@
ProfileGenerator* generator_;
ProfilerEventsProcessor* processor_;
int saved_logging_nesting_;
+ bool need_to_stop_sampler_;
Atomic32 is_profiling_;
#else
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Mon Mar 21 08:04:17 2011
+++ /branches/bleeding_edge/src/platform-linux.cc Mon Mar 21 10:40:40 2011
@@ -927,8 +927,9 @@
// Implement Thread::Run().
virtual void Run() {
- SamplerRegistry::State state = SamplerRegistry::GetState();
- while (state != SamplerRegistry::HAS_NO_SAMPLERS) {
+ SamplerRegistry::State state;
+ while ((state = SamplerRegistry::GetState()) !=
+ SamplerRegistry::HAS_NO_SAMPLERS) {
bool cpu_profiling_enabled =
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc Mon Mar 21 08:04:17 2011
+++ /branches/bleeding_edge/src/platform-macos.cc Mon Mar 21 10:40:40 2011
@@ -663,8 +663,9 @@
// Implement Thread::Run().
virtual void Run() {
- SamplerRegistry::State state = SamplerRegistry::GetState();
- while (state != SamplerRegistry::HAS_NO_SAMPLERS) {
+ SamplerRegistry::State state;
+ while ((state = SamplerRegistry::GetState()) !=
+ SamplerRegistry::HAS_NO_SAMPLERS) {
bool cpu_profiling_enabled =
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
@@ -684,7 +685,6 @@
}
}
OS::Sleep(interval_);
- state = SamplerRegistry::GetState();
}
}
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Mon Mar 21 08:04:17 2011
+++ /branches/bleeding_edge/src/platform-win32.cc Mon Mar 21 10:40:40 2011
@@ -1914,8 +1914,9 @@
// Implement Thread::Run().
virtual void Run() {
- SamplerRegistry::State state = SamplerRegistry::GetState();
- while (state != SamplerRegistry::HAS_NO_SAMPLERS) {
+ SamplerRegistry::State state;
+ while ((state = SamplerRegistry::GetState()) !=
+ SamplerRegistry::HAS_NO_SAMPLERS) {
bool cpu_profiling_enabled =
(state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS);
bool runtime_profiler_enabled = RuntimeProfiler::IsEnabled();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev