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

Unified Diff: src/log.cc

Issue 2053523003: Refactor CpuProfiler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 6 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
« no previous file with comments | « src/log.h ('k') | src/profiler/cpu-profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index 040109535b247f2cf660b7f3e5646fef23afed89..8e41726036b3c65d87550463173163ec9cda592a 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -22,6 +22,7 @@
#include "src/macro-assembler.h"
#include "src/perf-jit.h"
#include "src/profiler/cpu-profiler-inl.h"
+#include "src/profiler/profiler-listener.h"
#include "src/runtime-profiler.h"
#include "src/string-stream.h"
#include "src/vm-state-inl.h"
@@ -1789,6 +1790,8 @@ bool Logger::SetUp(Isolate* isolate) {
profiler_->Engage();
}
+ profiler_listener_.reset();
+
if (is_logging_) {
addCodeEventListener(this);
}
@@ -1816,6 +1819,18 @@ void Logger::SetCodeEventHandler(uint32_t options,
}
}
+void Logger::SetUpProfilerListener() {
+ if (!is_initialized_) return;
+ if (profiler_listener_.get() == nullptr) {
+ profiler_listener_.reset(new ProfilerListener(isolate_));
+ }
+ addCodeEventListener(profiler_listener_.get());
+}
+
+void Logger::TearDownProfilerListener() {
+ if (profiler_listener_->HasObservers()) return;
+ removeCodeEventListener(profiler_listener_.get());
+}
sampler::Sampler* Logger::sampler() {
return ticker_;
@@ -1860,6 +1875,10 @@ FILE* Logger::TearDown() {
jit_logger_ = NULL;
}
+ if (profiler_listener_.get() != nullptr) {
+ removeCodeEventListener(profiler_listener_.get());
+ }
+
return log_->Close();
}
« no previous file with comments | « src/log.h ('k') | src/profiler/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698