diff options
author | James M Snell <jasnell@gmail.com> | 2018-08-04 19:48:50 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-08-10 17:43:23 +0300 |
commit | c85933cbd07ec3e32fdb27c4c4ef1aeadc609345 (patch) | |
tree | 84a5b5137bb9c5320357d59c012a977d2d82d1dd /src/async_wrap.cc | |
parent | 88bff82624628df261a429386d81565023062e44 (diff) |
trace_events,async_hooks: use intrinsic trace
Switch to using the intrinsic trace event method for async_hooks.
This is a breaking change because of the switch to a nested data
argument for exec id and trigger id values.
PR-URL: https://github.com/nodejs/node/pull/22127
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'src/async_wrap.cc')
-rw-r--r-- | src/async_wrap.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 7f2a0ece2f0..51072bb8c9c 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -23,6 +23,7 @@ #include "env-inl.h" #include "node_internals.h" #include "util-inl.h" +#include "tracing/traced_value.h" #include "v8.h" #include "v8-profiler.h" @@ -608,13 +609,18 @@ void AsyncWrap::AsyncReset(double execution_async_id, bool silent) { switch (provider_type()) { #define V(PROVIDER) \ case PROVIDER_ ## PROVIDER: \ - 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()), \ - "triggerAsyncId", \ - static_cast<int64_t>(get_trigger_async_id())); \ + if (*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( \ + TRACING_CATEGORY_NODE1(async_hooks))) { \ + auto data = tracing::TracedValue::Create(); \ + data->SetInteger("executionAsyncId", \ + static_cast<int64_t>(env()->execution_async_id())); \ + data->SetInteger("triggerAsyncId", \ + static_cast<int64_t>(get_trigger_async_id())); \ + TRACE_EVENT_NESTABLE_ASYNC_BEGIN1( \ + TRACING_CATEGORY_NODE1(async_hooks), \ + #PROVIDER, static_cast<int64_t>(get_async_id()), \ + "data", std::move(data)); \ + } \ break; NODE_ASYNC_PROVIDER_TYPES(V) #undef V |