summaryrefslogtreecommitdiff
path: root/deps/v8/src/cpu-profiler.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-04-23 12:05:36 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-04-23 12:05:36 -0700
commite72b7b8002c487d32f3a651687acca13f2009b99 (patch)
tree81a6aacbf385709a83cd095c04ec7ba44bb754bc /deps/v8/src/cpu-profiler.cc
parent7a34afba773a09c7862759872905657ec9629351 (diff)
downloadnode-new-e72b7b8002c487d32f3a651687acca13f2009b99.tar.gz
Upgrade V8 to 2.2.4.2
Diffstat (limited to 'deps/v8/src/cpu-profiler.cc')
-rw-r--r--deps/v8/src/cpu-profiler.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/deps/v8/src/cpu-profiler.cc b/deps/v8/src/cpu-profiler.cc
index 22937c0fbb..ed3f6925e0 100644
--- a/deps/v8/src/cpu-profiler.cc
+++ b/deps/v8/src/cpu-profiler.cc
@@ -29,7 +29,7 @@
#include "cpu-profiler-inl.h"
-#ifdef ENABLE_CPP_PROFILES_PROCESSOR
+#ifdef ENABLE_LOGGING_AND_PROFILING
#include "log-inl.h"
@@ -253,14 +253,12 @@ void CpuProfiler::StartProfiling(String* title) {
CpuProfile* CpuProfiler::StopProfiling(const char* title) {
- ASSERT(singleton_ != NULL);
- return singleton_->StopCollectingProfile(title);
+ return is_profiling() ? singleton_->StopCollectingProfile(title) : NULL;
}
CpuProfile* CpuProfiler::StopProfiling(String* title) {
- ASSERT(singleton_ != NULL);
- return singleton_->StopCollectingProfile(title);
+ return is_profiling() ? singleton_->StopCollectingProfile(title) : NULL;
}
@@ -422,6 +420,10 @@ void CpuProfiler::StartProcessorIfNotStarted() {
generator_ = new ProfileGenerator(profiles_);
processor_ = new ProfilerEventsProcessor(generator_);
processor_->Start();
+ // Enable stack sampling.
+ // It is important to have it started prior to logging, see issue 683:
+ // http://code.google.com/p/v8/issues/detail?id=683
+ reinterpret_cast<Sampler*>(Logger::ticker_)->Start();
// Enumerate stuff we already have in the heap.
if (Heap::HasBeenSetup()) {
Logger::LogCodeObjects();
@@ -429,15 +431,14 @@ void CpuProfiler::StartProcessorIfNotStarted() {
Logger::LogFunctionObjects();
Logger::LogAccessorCallbacks();
}
- // Enable stack sampling.
- reinterpret_cast<Sampler*>(Logger::ticker_)->Start();
}
}
CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) {
+ const double actual_sampling_rate = generator_->actual_sampling_rate();
StopProcessorIfLastProfile();
- CpuProfile* result = profiles_->StopProfiling(title);
+ CpuProfile* result = profiles_->StopProfiling(title, actual_sampling_rate);
if (result != NULL) {
result->Print();
}
@@ -446,8 +447,9 @@ CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) {
CpuProfile* CpuProfiler::StopCollectingProfile(String* title) {
+ const double actual_sampling_rate = generator_->actual_sampling_rate();
StopProcessorIfLastProfile();
- return profiles_->StopProfiling(title);
+ return profiles_->StopProfiling(title, actual_sampling_rate);
}
@@ -466,13 +468,13 @@ void CpuProfiler::StopProcessorIfLastProfile() {
} } // namespace v8::internal
-#endif // ENABLE_CPP_PROFILES_PROCESSOR
+#endif // ENABLE_LOGGING_AND_PROFILING
namespace v8 {
namespace internal {
void CpuProfiler::Setup() {
-#ifdef ENABLE_CPP_PROFILES_PROCESSOR
+#ifdef ENABLE_LOGGING_AND_PROFILING
if (singleton_ == NULL) {
singleton_ = new CpuProfiler();
}
@@ -481,7 +483,7 @@ void CpuProfiler::Setup() {
void CpuProfiler::TearDown() {
-#ifdef ENABLE_CPP_PROFILES_PROCESSOR
+#ifdef ENABLE_LOGGING_AND_PROFILING
if (singleton_ != NULL) {
delete singleton_;
}