Commit 2363cdfe authored by Ali Ijaz Sheikh's avatar Ali Ijaz Sheikh Committed by Commit Bot

[tracing] do not add traces when disabled

https://github.com/nodejs/node/issues/21038

Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
Reviewed-on: https://chromium-review.googlesource.com/1217726
Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55809}
parent d28286f2
......@@ -78,7 +78,8 @@ uint64_t TracingController::AddTraceEvent(
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags) {
uint64_t handle;
uint64_t handle = 0;
if (mode_ != DISABLED) {
TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
if (trace_object) {
trace_object->Initialize(
......@@ -86,6 +87,7 @@ uint64_t TracingController::AddTraceEvent(
arg_names, arg_types, arg_values, arg_convertables, flags,
CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds());
}
}
return handle;
}
......@@ -96,7 +98,8 @@ 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;
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,
......@@ -104,6 +107,7 @@ uint64_t TracingController::AddTraceEventWithTimestamp(
arg_values, arg_convertables, flags, timestamp,
CurrentCpuTimestampMicroseconds());
}
}
return handle;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment