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

Unified Diff: src/profiler/tracing-cpu-profiler.cc

Issue 2676403002: [tracing] The CPU profiler should only be enabled for specific modes of tracing (Closed)
Patch Set: Use TRACE_EVENT_CATEGORY_GROUP_ENABLED. Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/tracing-cpu-profiler.cc
diff --git a/src/profiler/tracing-cpu-profiler.cc b/src/profiler/tracing-cpu-profiler.cc
index 8b3122590500925c312d2a4377d4ede4617d8cb8..49991376048261cf25970d65dc9d3f6a51a84b5a 100644
--- a/src/profiler/tracing-cpu-profiler.cc
+++ b/src/profiler/tracing-cpu-profiler.cc
@@ -8,8 +8,8 @@
#include "src/tracing/trace-event.h"
#include "src/v8.h"
-#define PROFILER_TRACE_CATEGORY_ENABLED(cat) \
- (*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT(cat)))
+#define PROFILER_TRACE_CATEGORY_ENABLED(cat, ret) \
alph 2017/02/09 18:23:56 Don't think this macro makes sense now. You can ju
ssid 2017/02/10 01:47:41 Done.
+ TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT(cat), ret)
namespace v8 {
@@ -25,8 +25,9 @@ namespace internal {
TracingCpuProfilerImpl::TracingCpuProfilerImpl(Isolate* isolate)
: isolate_(isolate), profiling_enabled_(false) {
// Make sure tracing system notices profiler categories.
- PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler");
- PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler.hires");
+ TRACE_EVENT_WARMUP_CATEGORY(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"));
+ TRACE_EVENT_WARMUP_CATEGORY(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler.hires"));
V8::GetCurrentPlatform()->AddTraceStateObserver(this);
}
@@ -36,7 +37,9 @@ TracingCpuProfilerImpl::~TracingCpuProfilerImpl() {
}
void TracingCpuProfilerImpl::OnTraceEnabled() {
- if (!PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler")) return;
+ bool enabled;
+ PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler", &enabled);
+ if (!enabled) return;
profiling_enabled_ = true;
isolate_->RequestInterrupt(
[](v8::Isolate*, void* data) {
@@ -59,8 +62,9 @@ void TracingCpuProfilerImpl::OnTraceDisabled() {
void TracingCpuProfilerImpl::StartProfiling() {
base::LockGuard<base::Mutex> lock(&mutex_);
if (!profiling_enabled_ || profiler_) return;
- int sampling_interval_us =
- PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler.hires") ? 100 : 1000;
+ bool enabled;
+ PROFILER_TRACE_CATEGORY_ENABLED("v8.cpu_profiler.hires", &enabled);
+ int sampling_interval_us = enabled ? 100 : 1000;
profiler_.reset(new CpuProfiler(isolate_));
profiler_->set_sampling_interval(
base::TimeDelta::FromMicroseconds(sampling_interval_us));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698