Skip to content

Commit

Permalink
src: add trace_event macros to AsyncWrap
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgav committed Mar 29, 2017
1 parent 3d6d61c commit fda406f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/async-wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Function> init_fn = env->async_hooks_init_function();

// No init callback exists, no reason to go on.
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit fda406f

Please sign in to comment.