|
@ -42,6 +42,20 @@ extern int events_enabled; |
|
|
#define ETW_WRITE_INT32_DATA(data_descriptor, data) \ |
|
|
#define ETW_WRITE_INT32_DATA(data_descriptor, data) \ |
|
|
EventDataDescCreate(data_descriptor, data, sizeof(int32_t)); |
|
|
EventDataDescCreate(data_descriptor, data, sizeof(int32_t)); |
|
|
|
|
|
|
|
|
|
|
|
#define ETW_WRITE_INT64_DATA(data_descriptor, data) \ |
|
|
|
|
|
EventDataDescCreate(data_descriptor, data, sizeof(int64_t)); |
|
|
|
|
|
|
|
|
|
|
|
#define ETW_WRITE_ADDRESS_DATA(data_descriptor, data) \ |
|
|
|
|
|
EventDataDescCreate(data_descriptor, data, sizeof(intptr_t)); |
|
|
|
|
|
|
|
|
|
|
|
#define ETW_WRITE_INT16_DATA(data_descriptor, data) \ |
|
|
|
|
|
EventDataDescCreate(data_descriptor, data, sizeof(int16_t)); |
|
|
|
|
|
|
|
|
|
|
|
#define ETW_WRITE_WSTRING_DATA_LENGTH(data_descriptor, data, data_len_bytes) \ |
|
|
|
|
|
EventDataDescCreate(data_descriptor, \ |
|
|
|
|
|
data, \ |
|
|
|
|
|
data_len_bytes); |
|
|
|
|
|
|
|
|
#define ETW_WRITE_NET_CONNECTION(descriptors, conn) \ |
|
|
#define ETW_WRITE_NET_CONNECTION(descriptors, conn) \ |
|
|
ETW_WRITE_INT32_DATA(descriptors, &conn->fd); \ |
|
|
ETW_WRITE_INT32_DATA(descriptors, &conn->fd); \ |
|
|
ETW_WRITE_INT32_DATA(descriptors + 1, &conn->port); \ |
|
|
ETW_WRITE_INT32_DATA(descriptors + 1, &conn->port); \ |
|
@ -61,6 +75,34 @@ extern int events_enabled; |
|
|
ETW_WRITE_INT32_DATA(descriptors, &type); \ |
|
|
ETW_WRITE_INT32_DATA(descriptors, &type); \ |
|
|
ETW_WRITE_INT32_DATA(descriptors + 1, &flags); |
|
|
ETW_WRITE_INT32_DATA(descriptors + 1, &flags); |
|
|
|
|
|
|
|
|
|
|
|
#define ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2) \ |
|
|
|
|
|
ETW_WRITE_ADDRESS_DATA(descriptors, &addr1); \ |
|
|
|
|
|
ETW_WRITE_ADDRESS_DATA(descriptors + 1, &addr2); |
|
|
|
|
|
|
|
|
|
|
|
#define ETW_WRITE_JSMETHOD_LOADUNLOAD(descriptors, \ |
|
|
|
|
|
context, \ |
|
|
|
|
|
startAddr, \ |
|
|
|
|
|
size, \ |
|
|
|
|
|
id, \ |
|
|
|
|
|
flags, \ |
|
|
|
|
|
rangeId, \ |
|
|
|
|
|
sourceId, \ |
|
|
|
|
|
line, \ |
|
|
|
|
|
col, \ |
|
|
|
|
|
name, \ |
|
|
|
|
|
name_len_bytes) \ |
|
|
|
|
|
ETW_WRITE_ADDRESS_DATA(descriptors, &context); \ |
|
|
|
|
|
ETW_WRITE_ADDRESS_DATA(descriptors + 1, &startAddr); \ |
|
|
|
|
|
ETW_WRITE_INT64_DATA(descriptors + 2, &size); \ |
|
|
|
|
|
ETW_WRITE_INT32_DATA(descriptors + 3, &id); \ |
|
|
|
|
|
ETW_WRITE_INT16_DATA(descriptors + 4, &flags); \ |
|
|
|
|
|
ETW_WRITE_INT16_DATA(descriptors + 5, &rangeId); \ |
|
|
|
|
|
ETW_WRITE_INT64_DATA(descriptors + 6, &sourceId); \ |
|
|
|
|
|
ETW_WRITE_INT32_DATA(descriptors + 7, &line); \ |
|
|
|
|
|
ETW_WRITE_INT32_DATA(descriptors + 8, &col); \ |
|
|
|
|
|
ETW_WRITE_WSTRING_DATA_LENGTH(descriptors + 9, name, name_len_bytes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define ETW_WRITE_EVENT(eventDescriptor, dataDescriptors) \ |
|
|
#define ETW_WRITE_EVENT(eventDescriptor, dataDescriptors) \ |
|
|
DWORD status = event_write(node_provider, \ |
|
|
DWORD status = event_write(node_provider, \ |
|
|
&eventDescriptor, \ |
|
|
&eventDescriptor, \ |
|
@ -133,6 +175,83 @@ void NODE_GC_DONE(GCType type, GCCallbackFlags flags) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void NODE_V8SYMBOL_REMOVE(const void* addr1, const void* addr2) { |
|
|
|
|
|
if (events_enabled > 0) { |
|
|
|
|
|
EVENT_DATA_DESCRIPTOR descriptors[2]; |
|
|
|
|
|
ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2); |
|
|
|
|
|
ETW_WRITE_EVENT(NODE_V8SYMBOL_REMOVE_EVENT, descriptors); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void NODE_V8SYMBOL_MOVE(const void* addr1, const void* addr2) { |
|
|
|
|
|
if (events_enabled > 0) { |
|
|
|
|
|
EVENT_DATA_DESCRIPTOR descriptors[2]; |
|
|
|
|
|
ETW_WRITE_V8ADDRESSCHANGE(descriptors, addr1, addr2); |
|
|
|
|
|
ETW_WRITE_EVENT(NODE_V8SYMBOL_MOVE_EVENT, descriptors); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void NODE_V8SYMBOL_RESET() { |
|
|
|
|
|
if (events_enabled > 0) { |
|
|
|
|
|
int val = 0; |
|
|
|
|
|
EVENT_DATA_DESCRIPTOR descriptors[1]; |
|
|
|
|
|
ETW_WRITE_INT32_DATA(descriptors, &val); |
|
|
|
|
|
ETW_WRITE_EVENT(NODE_V8SYMBOL_RESET_EVENT, descriptors); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#define SETSYMBUF(s) \ |
|
|
|
|
|
wcscpy(symbuf, s); \ |
|
|
|
|
|
symbol_len = ARRAY_SIZE(s) - 1; |
|
|
|
|
|
|
|
|
|
|
|
void NODE_V8SYMBOL_ADD(LPCSTR symbol, |
|
|
|
|
|
int symbol_len, |
|
|
|
|
|
const void* addr1, |
|
|
|
|
|
int len) { |
|
|
|
|
|
if (events_enabled > 0) { |
|
|
|
|
|
wchar_t symbuf[128]; |
|
|
|
|
|
if (symbol == NULL) { |
|
|
|
|
|
SETSYMBUF(L"NULL"); |
|
|
|
|
|
} else { |
|
|
|
|
|
symbol_len = MultiByteToWideChar(CP_ACP, 0, symbol, symbol_len, symbuf, 128); |
|
|
|
|
|
if (symbol_len == 0) { |
|
|
|
|
|
SETSYMBUF(L"Invalid"); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (symbol_len > 127) { |
|
|
|
|
|
symbol_len = 127; |
|
|
|
|
|
} |
|
|
|
|
|
symbuf[symbol_len] = L'\0'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
void* context = NULL; |
|
|
|
|
|
INT64 size = (INT64)len; |
|
|
|
|
|
INT32 id = (INT32)addr1; |
|
|
|
|
|
INT16 flags = 0; |
|
|
|
|
|
INT16 rangeid = 1; |
|
|
|
|
|
INT32 col = 1; |
|
|
|
|
|
INT32 line = 1; |
|
|
|
|
|
INT64 sourceid = 0; |
|
|
|
|
|
EVENT_DATA_DESCRIPTOR descriptors[10]; |
|
|
|
|
|
ETW_WRITE_JSMETHOD_LOADUNLOAD(descriptors, |
|
|
|
|
|
context, |
|
|
|
|
|
addr1, |
|
|
|
|
|
size, |
|
|
|
|
|
id, |
|
|
|
|
|
flags, |
|
|
|
|
|
rangeid, |
|
|
|
|
|
sourceid, |
|
|
|
|
|
line, |
|
|
|
|
|
col, |
|
|
|
|
|
symbuf, |
|
|
|
|
|
symbol_len * sizeof(symbuf[0])); |
|
|
|
|
|
ETW_WRITE_EVENT(MethodLoad, descriptors); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#undef SETSYMBUF |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool NODE_HTTP_SERVER_REQUEST_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_HTTP_SERVER_REQUEST_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_HTTP_SERVER_RESPONSE_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_HTTP_SERVER_RESPONSE_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_HTTP_CLIENT_REQUEST_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_HTTP_CLIENT_REQUEST_ENABLED() { return events_enabled > 0; } |
|
@ -141,5 +260,6 @@ bool NODE_NET_SERVER_CONNECTION_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_NET_STREAM_END_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_NET_STREAM_END_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_NET_SOCKET_READ_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_NET_SOCKET_READ_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_NET_SOCKET_WRITE_ENABLED() { return events_enabled > 0; } |
|
|
bool NODE_NET_SOCKET_WRITE_ENABLED() { return events_enabled > 0; } |
|
|
|
|
|
bool NODE_V8SYMBOL_ENABLED() { return events_enabled > 0; } |
|
|
} |
|
|
} |
|
|
#endif // SRC_ETW_INL_H_
|
|
|
#endif // SRC_ETW_INL_H_
|