-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Move EventPipe environment variable parsing logic to native code #32516
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
Changes from all commits
967e672
7b5e97f
5df4b8d
d2a787b
9d2f0b8
f2a9138
73dbabd
6098b6c
d845bb0
6515b7b
63a4a46
217fbd3
bba1446
d1632c5
75a5325
0bbcaea
878e0f4
8fcf438
e6fa99d
fc849a6
eee8f0e
3b0f1a8
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 |
|---|---|---|
|
|
@@ -234,6 +234,16 @@ extern UINT32 g_nClrInstanceId; | |
| #if defined(HOST_UNIX) && (defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT)) | ||
| #define KEYWORDZERO 0x0 | ||
|
|
||
| #define DEF_LTTNG_KEYWORD_ENABLED 1 | ||
| #ifdef FEATURE_EVENT_TRACE | ||
| #include "clrproviders.h" | ||
| #endif // FEATURE_EVENT_TRACE | ||
| #include "clrconfig.h" | ||
|
|
||
| #endif // defined(HOST_UNIX) && (defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT)) | ||
|
|
||
| #if defined(FEATURE_PERFTRACING) | ||
|
|
||
| /***************************************/ | ||
| /* Tracing levels supported by CLR ETW */ | ||
| /***************************************/ | ||
|
|
@@ -244,12 +254,6 @@ extern UINT32 g_nClrInstanceId; | |
| #define TRACE_LEVEL_INFORMATION 4 // Includes non-error cases such as Entry-Exit | ||
| #define TRACE_LEVEL_VERBOSE 5 // Detailed traces from intermediate steps | ||
|
|
||
| #define DEF_LTTNG_KEYWORD_ENABLED 1 | ||
| #ifdef FEATURE_EVENT_TRACE | ||
| #include "clrproviders.h" | ||
| #endif | ||
| #include "clrconfig.h" | ||
|
|
||
| class XplatEventLoggerConfiguration | ||
| { | ||
| public: | ||
|
|
@@ -284,6 +288,10 @@ class XplatEventLoggerConfiguration | |
|
|
||
| auto levelComponent = GetNextComponentString(keywordsComponent.End + 1); | ||
| _level = ParseLevel(levelComponent); | ||
|
|
||
| auto argumentComponent = GetNextComponentString(levelComponent.End + 1); | ||
| _argument = ParseArgument(argumentComponent); | ||
|
|
||
| _isValid = true; | ||
| } | ||
|
|
||
|
|
@@ -297,16 +305,21 @@ class XplatEventLoggerConfiguration | |
| return _provider; | ||
| } | ||
|
|
||
| ULONGLONG GetEnabledKeywordsMask() const | ||
| uint64_t GetEnabledKeywordsMask() const | ||
| { | ||
| return _enabledKeywords; | ||
| } | ||
|
|
||
| UINT GetLevel() const | ||
| uint32_t GetLevel() const | ||
| { | ||
| return _level; | ||
| } | ||
|
|
||
| LPCWSTR GetArgument() const | ||
| { | ||
| return _argument; | ||
| } | ||
|
|
||
| private: | ||
| struct ComponentSpan | ||
| { | ||
|
|
@@ -322,9 +335,8 @@ class XplatEventLoggerConfiguration | |
|
|
||
| ComponentSpan GetNextComponentString(LPCWSTR start) const | ||
| { | ||
| static WCHAR ComponentDelimiter = W(':'); | ||
|
|
||
| auto end = wcschr(start, ComponentDelimiter); | ||
| const WCHAR ComponentDelimiter = W(':'); | ||
| const WCHAR * end = wcschr(start, ComponentDelimiter); | ||
| if (end == nullptr) | ||
| { | ||
| end = start + wcslen(start); | ||
|
|
@@ -333,44 +345,61 @@ class XplatEventLoggerConfiguration | |
| return ComponentSpan(start, end); | ||
| } | ||
|
|
||
| LPCWSTR ParseProviderName(ComponentSpan const & component) const | ||
| NewArrayHolder<WCHAR> ParseProviderName(ComponentSpan const & component) const | ||
| { | ||
| auto providerName = (WCHAR*)nullptr; | ||
| NewArrayHolder<WCHAR> providerName = nullptr; | ||
| if ((component.End - component.Start) != 0) | ||
| { | ||
| auto const length = component.End - component.Start; | ||
| providerName = new WCHAR[length + 1]; | ||
| memset(providerName, '\0', (length + 1) * sizeof(WCHAR)); | ||
| wcsncpy(providerName, component.Start, length); | ||
| providerName[length] = '\0'; | ||
| } | ||
| return providerName; | ||
| } | ||
|
|
||
| ULONGLONG ParseEnabledKeywordsMask(ComponentSpan const & component) const | ||
| uint64_t ParseEnabledKeywordsMask(ComponentSpan const & component) const | ||
| { | ||
| auto enabledKeywordsMask = (ULONGLONG)(-1); | ||
| auto enabledKeywordsMask = (uint64_t)(-1); | ||
| if ((component.End - component.Start) != 0) | ||
| { | ||
| enabledKeywordsMask = _wcstoui64(component.Start, nullptr, 16); | ||
| } | ||
| return enabledKeywordsMask; | ||
| } | ||
|
|
||
| UINT ParseLevel(ComponentSpan const & component) const | ||
| uint32_t ParseLevel(ComponentSpan const & component) const | ||
| { | ||
| auto level = TRACE_LEVEL_VERBOSE; | ||
| int level = TRACE_LEVEL_VERBOSE; // Verbose | ||
| if ((component.End - component.Start) != 0) | ||
| { | ||
| level = _wtoi(component.Start); | ||
| } | ||
| return level; | ||
| } | ||
|
|
||
| LPCWSTR _provider; | ||
| ULONGLONG _enabledKeywords; | ||
| UINT _level; | ||
| NewArrayHolder<WCHAR> ParseArgument(ComponentSpan const & component) const | ||
| { | ||
| NewArrayHolder<WCHAR> argument = nullptr; | ||
| if ((component.End - component.Start) != 0) | ||
| { | ||
| auto const length = component.End - component.Start; | ||
| argument = new WCHAR[length + 1]; | ||
| wcsncpy(argument, component.Start, length); | ||
| argument[length] = '\0'; | ||
| } | ||
| return argument; | ||
| } | ||
|
|
||
| NewArrayHolder<WCHAR> _provider; | ||
| uint64_t _enabledKeywords; | ||
| uint32_t _level; | ||
| NewArrayHolder<WCHAR> _argument; | ||
| bool _isValid; | ||
| }; | ||
| #endif // FEATURE_PERFTRACING | ||
|
|
||
| #if defined(HOST_UNIX) && (defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT)) | ||
|
Member
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. @sywhang, we updated the build in #32746, so that user can build coreclr without One fix could be to change line 245 to Thanks!
Contributor
Author
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. @am11 ah, sorry about that!
That sounds fine to me. I will try to build without FEATURE_EVENT_TRACE before merging my PRs on EventPipe from future to prevent issues like that :)
Member
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. Thank you! My coreclr build on Android was failing at 11% and with that (two liner) patch (updated #endif comment as well), it has just succeeded (all green). 👍 I was wondering if we could get to run Android build even on weekly bases (AzDo scheduled jobs), that would help preserving the healthy state for this platform? It will also help validating this feature matrix. :) |
||
|
|
||
| class XplatEventLoggerController | ||
| { | ||
|
|
@@ -497,7 +526,7 @@ class XplatEventLogger | |
| } | ||
| while (configToParse != nullptr) | ||
| { | ||
| static WCHAR comma = W(','); | ||
| const WCHAR comma = W(','); | ||
| auto end = wcschr(configToParse, comma); | ||
| configuration.Parse(configToParse); | ||
| XplatEventLoggerController::UpdateProviderContext(configuration); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.