From: alph@chromium.org Date: Tue, 6 May 2014 08:18:09 +0000 (+0000) Subject: Make sure CPU profiler collects a sample on start. X-Git-Tag: upstream/4.7.83~9262 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d56f01ba1c1dfe298f70b5e26c4193896ff97656;p=platform%2Fupstream%2Fv8.git Make sure CPU profiler collects a sample on start. BUG=369035 LOG=N R=bmeurer@chromium.org, yurys@chromium.org Review URL: https://codereview.chromium.org/263883008 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21157 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc index eecf4dc..abe2934 100644 --- a/src/cpu-profiler.cc +++ b/src/cpu-profiler.cc @@ -418,30 +418,32 @@ void CpuProfiler::StartProfiling(String* title, bool record_samples) { void CpuProfiler::StartProcessorIfNotStarted() { - if (processor_ == NULL) { - Logger* logger = isolate_->logger(); - // Disable logging when using the new implementation. - saved_is_logging_ = logger->is_logging_; - logger->is_logging_ = false; - generator_ = new ProfileGenerator(profiles_); - Sampler* sampler = logger->sampler(); - processor_ = new ProfilerEventsProcessor( - generator_, sampler, sampling_interval_); - is_profiling_ = true; - // Enumerate stuff we already have in the heap. - ASSERT(isolate_->heap()->HasBeenSetUp()); - if (!FLAG_prof_browser_mode) { - logger->LogCodeObjects(); - } - logger->LogCompiledFunctions(); - logger->LogAccessorCallbacks(); - LogBuiltins(); - // Enable stack sampling. - sampler->SetHasProcessingThread(true); - sampler->IncreaseProfilingDepth(); + if (processor_ != NULL) { processor_->AddCurrentStack(isolate_); - processor_->StartSynchronously(); + return; + } + Logger* logger = isolate_->logger(); + // Disable logging when using the new implementation. + saved_is_logging_ = logger->is_logging_; + logger->is_logging_ = false; + generator_ = new ProfileGenerator(profiles_); + Sampler* sampler = logger->sampler(); + processor_ = new ProfilerEventsProcessor( + generator_, sampler, sampling_interval_); + is_profiling_ = true; + // Enumerate stuff we already have in the heap. + ASSERT(isolate_->heap()->HasBeenSetUp()); + if (!FLAG_prof_browser_mode) { + logger->LogCodeObjects(); } + logger->LogCompiledFunctions(); + logger->LogAccessorCallbacks(); + LogBuiltins(); + // Enable stack sampling. + sampler->SetHasProcessingThread(true); + sampler->IncreaseProfilingDepth(); + processor_->AddCurrentStack(isolate_); + processor_->StartSynchronously(); }