From fda406f83b064d690b686065435bc2d047e55f8b Mon Sep 17 00:00:00 2001 From: Josh Gavant Date: Wed, 29 Mar 2017 15:19:57 -0700 Subject: [PATCH] src: add trace_event macros to AsyncWrap --- src/async-wrap.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/async-wrap.cc b/src/async-wrap.cc index bc3e049d262c81..3b5bb9b4ec6da4 100644 --- a/src/async-wrap.cc +++ b/src/async-wrap.cc @@ -259,9 +259,18 @@ AsyncWrap::AsyncWrap(Environment* env, CHECK_NE(provider, PROVIDER_NONE); CHECK_GE(object->InternalFieldCount(), 1); + switch (provider_type()) { +#define V(PROVIDER) \ + case PROVIDER_ ## PROVIDER: \ + TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("node", #PROVIDER, get_uid()); \ + break; + NODE_ASYNC_PROVIDER_TYPES(V) +#undef V + } // Shift provider value over to prevent id collision. persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider); + Local init_fn = env->async_hooks_init_function(); // No init callback exists, no reason to go on. @@ -303,6 +312,14 @@ AsyncWrap::AsyncWrap(Environment* env, AsyncWrap::~AsyncWrap() { + switch (provider_type()) { +#define V(PROVIDER) \ + case PROVIDER_ ## PROVIDER: \ + TRACE_EVENT_NESTABLE_ASYNC_END0("node", #PROVIDER, get_uid()); \ + break; + NODE_ASYNC_PROVIDER_TYPES(V) +#undef V + } if (!ran_init_callback()) return;