Skip to content

Commit

Permalink
[tracing] do not add traces when disabled
Browse files Browse the repository at this point in the history
nodejs/node#21038

Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
Reviewed-on: https://chromium-review.googlesource.com/1217726
Commit-Queue: Ali Ijaz Sheikh <[email protected]>
Reviewed-by: Yang Guo <[email protected]>
Cr-Commit-Position: refs/heads/master@{#55809}
  • Loading branch information
ofrobots authored and Commit Bot committed Sep 11, 2018
1 parent d28286f commit 2363cdf
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/libplatform/tracing/tracing-controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ uint64_t TracingController::AddTraceEvent(
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags) {
uint64_t handle;
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(
phase, category_enabled_flag, name, scope, id, bind_id, num_args,
arg_names, arg_types, arg_values, arg_convertables, flags,
CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds());
uint64_t handle = 0;
if (mode_ != DISABLED) {
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(
phase, category_enabled_flag, name, scope, id, bind_id, num_args,
arg_names, arg_types, arg_values, arg_convertables, flags,
CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds());
}
}
return handle;
}
Expand All @@ -96,13 +98,15 @@ uint64_t TracingController::AddTraceEventWithTimestamp(
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags, int64_t timestamp) {
uint64_t handle;
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(phase, category_enabled_flag, name, scope, id,
bind_id, num_args, arg_names, arg_types,
arg_values, arg_convertables, flags, timestamp,
CurrentCpuTimestampMicroseconds());
uint64_t handle = 0;
if (mode_ != DISABLED) {
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(phase, category_enabled_flag, name, scope, id,
bind_id, num_args, arg_names, arg_types,
arg_values, arg_convertables, flags, timestamp,
CurrentCpuTimestampMicroseconds());
}
}
return handle;
}
Expand Down

0 comments on commit 2363cdf

Please sign in to comment.