-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support for emitting ETW events to LTTng #4314
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,10 @@ if(CAN_BUILD_WABT) | |
set(wabt_includes ${CHAKRACORE_SOURCE_DIR}/lib/wabt) | ||
endif() | ||
|
||
if (USE_LTTNG) | ||
set(lttng_objects $<TARGET_OBJECTS:Chakra.LTTng>) | ||
endif() | ||
|
||
add_library (ChakraCoreStatic STATIC | ||
ChakraCoreStatic.cpp | ||
$<TARGET_OBJECTS:Chakra.Pal> | ||
|
@@ -38,8 +42,16 @@ add_library (ChakraCoreStatic STATIC | |
$<TARGET_OBJECTS:Chakra.Parser> | ||
${wasm_objects} | ||
${wabt_objects} | ||
${lttng_objects} | ||
) | ||
|
||
if(USE_LTTNG) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lttng is not for osx ++ we better share target_link_libs below.. So, move this under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having multiple There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be nice to combine them in the same place in order to prevent future |
||
target_link_libraries(ChakraCoreStatic | ||
-llttng-ust | ||
-ldl | ||
) | ||
endif() | ||
|
||
if(CC_TARGET_OS_OSX) | ||
target_link_libraries(ChakraCoreStatic | ||
"-framework CoreFoundation" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,10 @@ | |
#define JS_ETW(s) s | ||
#define IS_JS_ETW(s) s | ||
|
||
#ifdef ENABLE_JS_LTTNG | ||
#include "jscriptEtw.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is somewhat confusing here (if lttng { include etw }) -- can the output file be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
#else | ||
// C-style callback | ||
extern "C" { | ||
void EtwCallback( | ||
|
@@ -87,6 +91,7 @@ class EtwTraceCore | |
|
||
static bool s_registered; | ||
}; | ||
#endif // ENABLE_JS_LTTNG | ||
|
||
#else | ||
#define GCETW(e, ...) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5968,7 +5968,8 @@ Recycler::ThreadProc() | |
} | ||
#endif | ||
|
||
#ifdef ENABLE_JS_ETW | ||
#if defined(ENABLE_JS_ETW) && ! defined(ENABLE_JS_LTTNG) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because LTTng doesn't have any concept of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps call that out as the reason why, here? |
||
// LTTng has no concept of EventActivityIdControl | ||
// Create an ETW ActivityId for this thread, to help tools correlate ETW events we generate | ||
GUID activityId = { 0 }; | ||
auto eventActivityIdControlResult = EventActivityIdControl(EVENT_ACTIVITY_CTRL_CREATE_SET_ID, &activityId); | ||
|
@@ -6536,7 +6537,8 @@ RecyclerParallelThread::StaticThreadProc(LPVOID lpParameter) | |
dllHandle = NULL; | ||
} | ||
#endif | ||
#ifdef ENABLE_JS_ETW | ||
#if defined(ENABLE_JS_ETW) && ! defined(ENABLE_JS_LTTNG) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? |
||
// LTTng has no concept of EventActivityIdControl | ||
// Create an ETW ActivityId for this thread, to help tools correlate ETW events we generate | ||
GUID activityId = { 0 }; | ||
auto eventActivityIdControlResult = EventActivityIdControl(EVENT_ACTIVITY_CTRL_CREATE_SET_ID, &activityId); | ||
|
@@ -8757,4 +8759,4 @@ template char* Recycler::AllocZeroWithAttributesInlined<RecyclerVisitedHostTrace | |
template char* Recycler::AllocZeroWithAttributesInlined<RecyclerVisitedHostFinalizableBits, /* nothrow = */true>(size_t); | ||
template char* Recycler::AllocZeroWithAttributesInlined<RecyclerVisitedHostTracedBits, /* nothrow = */true>(size_t); | ||
template char* Recycler::AllocZeroWithAttributesInlined<LeafBit, /* nothrow = */true>(size_t); | ||
#endif | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,7 @@ void JsrtCallbackState::ObjectBeforeCallectCallbackWrapper(JsObjectBeforeCollect | |
ConfigParser::ParseOnModuleLoad(parser, mod); | ||
} | ||
|
||
#ifdef ENABLE_JS_ETW | ||
#if defined(ENABLE_JS_ETW) && !defined(ENABLE_JS_LTTNG) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LTTng doesn't have the same register/unregister hooks that ETW has, so this is irrelevant for LTTng, and I thought it was simpler to just remove/avoid the whole registration concept. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might implement dummy functions instead? Why -> Adding an additional platform comes with an additional set of dependencies / call requirements. It could be nice to have a common interface (even if it's a dummy function) |
||
EtwTrace::Register(); | ||
#endif | ||
#ifdef VTUNE_PROFILING | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
using namespace Js; | ||
|
||
#ifndef ENABLE_JS_LTTNG | ||
// | ||
// This C style callback is invoked by ETW when a trace session is started/stopped | ||
// by an ETW controller for the Jscript and MSHTML providers. | ||
|
@@ -47,14 +48,17 @@ void EtwCallbackApi::OnSessionChange(ULONG controlCode, PVOID callbackContext) | |
} | ||
} | ||
} | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: could be nice to add |
||
|
||
// | ||
// Registers the ETW provider - this is usually done on Jscript DLL load | ||
// After registration, we will receive callbacks when ETW tracing is enabled/disabled. | ||
// | ||
void EtwTrace::Register() | ||
{ | ||
#ifndef ENABLE_JS_LTTNG | ||
EtwTraceCore::Register(); | ||
#endif | ||
|
||
#ifdef TEST_ETW_EVENTS | ||
TestEtwEventSink::Load(); | ||
|
@@ -66,8 +70,10 @@ void EtwTrace::Register() | |
// | ||
void EtwTrace::UnRegister() | ||
{ | ||
#ifndef ENABLE_JS_LTTNG | ||
EtwTraceCore::UnRegister(); | ||
|
||
#endif | ||
|
||
#ifdef TEST_ETW_EVENTS | ||
TestEtwEventSink::Unload(); | ||
#endif | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show error / warning if it's used on OSX? or add a note here?