Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ void AsyncWrap::EmitPromiseResolve(Environment* env, double async_id) {
}

void AsyncWrap::EmitTraceAsyncStart() const {
if (*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
TRACING_CATEGORY_NODE1(async_hooks))) {
if (TRACE_EVENT_CATEGORY_ENABLED(TRACING_CATEGORY_NODE1(async_hooks))) {
tracing::AsyncWrapArgs data(env()->execution_async_id(),
get_trigger_async_id());
TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE1(async_hooks),
Expand Down
3 changes: 1 addition & 2 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {

ContextifyScript* contextify_script = New(env, args.This());

if (*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
TRACING_CATEGORY_NODE2(vm, script)) != 0) {
if (TRACE_EVENT_CATEGORY_ENABLED(TRACING_CATEGORY_NODE2(vm, script))) {
Utf8Value fn(isolate, filename);
TRACE_EVENT_BEGIN1(TRACING_CATEGORY_NODE2(vm, script),
"ContextifyScript::New",
Expand Down
3 changes: 1 addition & 2 deletions src/node_dir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ static const char* get_dir_func_name_by_type(uv_fs_type req_type) {

#define TRACE_NAME(name) "fs_dir.sync." #name
#define GET_TRACE_ENABLED \
(*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( \
TRACING_CATEGORY_NODE2(fs_dir, sync)) != 0)
TRACE_EVENT_CATEGORY_ENABLED(TRACING_CATEGORY_NODE2(fs_dir, sync))
#define FS_DIR_SYNC_TRACE(syscall) \
if (GET_TRACE_ENABLED) { \
TRACE_EVENT0(TRACING_CATEGORY_NODE2(fs_dir, sync), TRACE_NAME(syscall)); \
Expand Down
3 changes: 1 addition & 2 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ static const char* get_fs_func_name_by_type(uv_fs_type req_type) {

#define TRACE_NAME(name) "fs.sync." #name
#define GET_TRACE_ENABLED \
(*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( \
TRACING_CATEGORY_NODE2(fs, sync)) != 0)
TRACE_EVENT_CATEGORY_ENABLED(TRACING_CATEGORY_NODE2(fs, sync))
#define FS_SYNC_TRACE_BEGIN(syscall, ...) \
if (GET_TRACE_ENABLED) \
TRACE_EVENT_BEGIN( \
Expand Down
8 changes: 8 additions & 0 deletions src/tracing/trace_event_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,14 @@
} \
} while (0)

// Expression form of the above, matching Perfetto's macro of the same name.
#define TRACE_EVENT_CATEGORY_ENABLED(category_group) \
([] { \
bool enabled; \
TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, &enabled); \
return enabled; \
}())

// Macro to explicitly warm up a given category group. This could be useful in
// cases where we want to initialize a category group before any trace events
// for that category group is reported. For example, to have a category group
Expand Down
Loading