diff options
author | James M Snell <jasnell@gmail.com> | 2018-03-06 01:46:19 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-03-09 19:09:41 +0300 |
commit | 1dd9c9787bcf08db022ee63ce633fc9d497720e6 (patch) | |
tree | a10c638dfd43b2ef784cc8431ecd68a58c3aeb1e /src/async_wrap.cc | |
parent | 45277e23d5488dc11d705b850d310b4afb5085bb (diff) |
src: add tracing category macros
Adds `TRACING_CATEGORY_NODE`, `TRACING_CATEGORY_NODE1` and
`TRACING_CATEGORY_NODE2` helper macros for consistently building
trace event category strings. For instance,
`TRACING_CATEGORY_NODE2(foo, bar)` would generate the category
string `node,node.foo,node.foo.bar`, such that...
```
TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(
TRACING_CATEGORY_NODE2(foo, bar),
"baz", 1);
```
Would emit if trace events are enabled for categories: `node`,
`node.foo`, or `node.foo.bar`.
This allows a natural scoping down of what trace events a user
may want to receive. Enabling the `node` category would receive
everything Node.js produces.
PR-URL: https://github.com/nodejs/node/pull/19155
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Diffstat (limited to 'src/async_wrap.cc')
-rw-r--r-- | src/async_wrap.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/async_wrap.cc b/src/async_wrap.cc index e2656e4eec3..239e607b05a 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -179,7 +179,8 @@ void AsyncWrap::EmitTraceEventBefore() { switch (provider_type()) { #define V(PROVIDER) \ case PROVIDER_ ## PROVIDER: \ - TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("node.async_hooks", \ + TRACE_EVENT_NESTABLE_ASYNC_BEGIN0( \ + TRACING_CATEGORY_NODE1(async_hooks), \ #PROVIDER "_CALLBACK", static_cast<int64_t>(get_async_id())); \ break; NODE_ASYNC_PROVIDER_TYPES(V) @@ -207,7 +208,8 @@ void AsyncWrap::EmitTraceEventAfter() { switch (provider_type()) { #define V(PROVIDER) \ case PROVIDER_ ## PROVIDER: \ - TRACE_EVENT_NESTABLE_ASYNC_END0("node.async_hooks", \ + TRACE_EVENT_NESTABLE_ASYNC_END0( \ + TRACING_CATEGORY_NODE1(async_hooks), \ #PROVIDER "_CALLBACK", static_cast<int64_t>(get_async_id())); \ break; NODE_ASYNC_PROVIDER_TYPES(V) @@ -631,7 +633,8 @@ void AsyncWrap::EmitTraceEventDestroy() { switch (provider_type()) { #define V(PROVIDER) \ case PROVIDER_ ## PROVIDER: \ - TRACE_EVENT_NESTABLE_ASYNC_END0("node.async_hooks", \ + TRACE_EVENT_NESTABLE_ASYNC_END0( \ + TRACING_CATEGORY_NODE1(async_hooks), \ #PROVIDER, static_cast<int64_t>(get_async_id())); \ break; NODE_ASYNC_PROVIDER_TYPES(V) @@ -664,7 +667,8 @@ void AsyncWrap::AsyncReset(double execution_async_id, bool silent) { switch (provider_type()) { #define V(PROVIDER) \ case PROVIDER_ ## PROVIDER: \ - TRACE_EVENT_NESTABLE_ASYNC_BEGIN2("node.async_hooks", \ + TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( \ + TRACING_CATEGORY_NODE1(async_hooks), \ #PROVIDER, static_cast<int64_t>(get_async_id()), \ "executionAsyncId", \ static_cast<int64_t>(env()->execution_async_id()), \ |