Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lttng: updated flags for gc tracing #3388

Closed
wants to merge 2 commits into from
Closed
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
60 changes: 31 additions & 29 deletions src/node_lttng_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@

namespace node {

#define FOR_ALL_GC_TYPES(APPLY) \
APPLY(kGCTypeScavenge) \
APPLY(kGCTypeMarkSweepCompact) \
APPLY(kGCTypeAll)

#define FOR_ALL_GC_CALLBACK_FLAGS(APPLY) \
APPLY(kNoGCCallbackFlags) \
APPLY(kGCCallbackFlagConstructRetainedObjectInfos) \
APPLY(kGCCallbackFlagForced) \
APPLY(kGCCallbackFlagSynchronousPhantomCallbackProcessing)

void NODE_HTTP_SERVER_REQUEST(node_lttng_http_server_request_t* req,
node_lttng_connection_t* conn,
const char *remote, int port,
Expand Down Expand Up @@ -48,42 +59,33 @@ void NODE_NET_STREAM_END(node_lttng_connection_t* conn,
void NODE_GC_START(v8::GCType type,
v8::GCCallbackFlags flags,
v8::Isolate* isolate) {
const char* typeStr = "";
const char* flagsStr = "";
if (type == v8::GCType::kGCTypeScavenge) {
typeStr = "kGCTypeScavenge";
} else if (type == v8::GCType::kGCTypeMarkSweepCompact) {
typeStr = "kGCTypeMarkSweepCompact";
} else if (type == v8::GCType::kGCTypeAll) {
typeStr = "kGCTypeAll";
}
if (flags == v8::GCCallbackFlags::kNoGCCallbackFlags) {
flagsStr = "kNoGCCallbackFlags";
} else if (flags == v8::GCCallbackFlags::kGCCallbackFlagCompacted) {
flagsStr = "kGCCallbackFlagCompacted";
}
const char* typeStr = "Unkown GC Type";
const char* flagsStr = "Unknown GC Flag";

#define BUILD_IF(f) if(type == v8::GCType::f){ typeStr = #f; }
FOR_ALL_GC_TYPES(BUILD_IF);
#undef BUILD_IF

#define BUILD_IF(f) if(flags == v8::GCCallbackFlags::f){ flagsStr = #f; }
FOR_ALL_GC_CALLBACK_FLAGS(BUILD_IF);
#undef BUILD_IF

tracepoint(node, gc_start, typeStr, flagsStr);
}


void NODE_GC_DONE(v8::GCType type,
v8::GCCallbackFlags flags,
v8::Isolate* isolate) {
const char* typeStr = "";
const char* flagsStr = "";
if (type == v8::GCType::kGCTypeScavenge) {
typeStr = "kGCTypeScavenge";
} else if (type == v8::GCType::kGCTypeMarkSweepCompact) {
typeStr = "kGCTypeMarkSweepCompact";
} else if (type == v8::GCType::kGCTypeAll) {
typeStr = "kGCTypeAll";
}
if (flags == v8::GCCallbackFlags::kNoGCCallbackFlags) {
flagsStr = "kNoGCCallbackFlags";
} else if (flags == v8::GCCallbackFlags::kGCCallbackFlagCompacted) {
flagsStr = "kGCCallbackFlagCompacted";
}
const char* typeStr = "Unkown GC Type";
const char* flagsStr = "Unknown GC Flag";

#define BUILD_IF(f) if(type == v8::GCType::f){ typeStr = #f; }
FOR_ALL_GC_TYPES(BUILD_IF);
#undef BUILD_IF

#define BUILD_IF(f) if(flags == v8::GCCallbackFlags::f){ flagsStr = #f; }
FOR_ALL_GC_CALLBACK_FLAGS(BUILD_IF);
#undef BUILD_IF

tracepoint(node, gc_done, typeStr, flagsStr);
}
Expand Down