Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: src/cpu-profiler.cc

Issue 1635005: Allow new CPU profiling subsystem to coexist nicely with the old one. (Closed)
Patch Set: Fix TickSampleEvent Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/cpu-profiler.cc
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc
index 5b862276990a91488f8f40a650a0ee872cb17fa2..22937c0fbbedc2f2ea29fd352735050147c02eab 100644
--- a/src/cpu-profiler.cc
+++ b/src/cpu-profiler.cc
@@ -283,8 +283,7 @@ CpuProfile* CpuProfiler::FindProfile(unsigned uid) {
TickSample* CpuProfiler::TickSampleEvent() {
- ASSERT(singleton_ != NULL);
- if (singleton_->is_profiling()) {
+ if (CpuProfiler::is_profiling()) {
return singleton_->processor_->TickSampleEvent();
} else {
return NULL;
@@ -417,6 +416,9 @@ void CpuProfiler::StartCollectingProfile(String* title) {
void CpuProfiler::StartProcessorIfNotStarted() {
if (processor_ == NULL) {
+ // Disable logging when using the new implementation.
+ saved_logging_nesting_ = Logger::logging_nesting_;
+ Logger::logging_nesting_ = 0;
generator_ = new ProfileGenerator(profiles_);
processor_ = new ProfilerEventsProcessor(generator_);
processor_->Start();
@@ -428,7 +430,7 @@ void CpuProfiler::StartProcessorIfNotStarted() {
Logger::LogAccessorCallbacks();
}
// Enable stack sampling.
- Logger::ticker_->Start();
+ reinterpret_cast<Sampler*>(Logger::ticker_)->Start();
}
}
@@ -451,13 +453,14 @@ CpuProfile* CpuProfiler::StopCollectingProfile(String* title) {
void CpuProfiler::StopProcessorIfLastProfile() {
if (profiles_->is_last_profile()) {
- Logger::ticker_->Stop();
+ reinterpret_cast<Sampler*>(Logger::ticker_)->Stop();
processor_->Stop();
processor_->Join();
delete processor_;
delete generator_;
processor_ = NULL;
generator_ = NULL;
+ Logger::logging_nesting_ = saved_logging_nesting_;
}
}
« no previous file with comments | « src/cpu-profiler.h ('k') | src/cpu-profiler-inl.h » ('j') | src/cpu-profiler-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698