summaryrefslogtreecommitdiff
path: root/src/inc
diff options
context:
space:
mode:
authorSung Yoon Whang <suwhang@microsoft.com>2019-06-27 23:04:58 -0700
committerGitHub <noreply@github.com>2019-06-27 23:04:58 -0700
commit6ab02e1cc487c64fb733fbb9d1be653337691aff (patch)
treee8bb360a33f59fb7033c1f99e01b9d3708415c6c /src/inc
parenta9976e15e2a6182e40a15f07f3004b3079d0742e (diff)
downloadcoreclr-6ab02e1cc487c64fb733fbb9d1be653337691aff.tar.gz
coreclr-6ab02e1cc487c64fb733fbb9d1be653337691aff.tar.bz2
coreclr-6ab02e1cc487c64fb733fbb9d1be653337691aff.zip
Enable parsing multiple providers for LTTngConfig variable (#25451)
* Enable parsing multiple providers for LTTngConfig variable * Handle case where LTTngConfig==NULL * renaming some methods * Add comment about the format of environment variable being parsed
Diffstat (limited to 'src/inc')
-rw-r--r--src/inc/eventtracebase.h97
1 files changed, 55 insertions, 42 deletions
diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h
index 09c82fcb7b..43147f5a6f 100644
--- a/src/inc/eventtracebase.h
+++ b/src/inc/eventtracebase.h
@@ -257,9 +257,22 @@ public:
_provider = nullptr;
}
- void Initialize(LPWSTR configString)
+ void Parse(LPWSTR configString)
{
- Parse(configString);
+ auto providerComponent = GetNextComponentString(configString);
+ _provider = ParseProviderName(providerComponent);
+ if (_provider == nullptr)
+ {
+ _isValid = false;
+ return;
+ }
+
+ auto keywordsComponent = GetNextComponentString(providerComponent.End + 1);
+ _enabledKeywords = ParseEnabledKeywordsMask(keywordsComponent);
+
+ auto levelComponent = GetNextComponentString(keywordsComponent.End + 1);
+ _level = ParseEnabledKeywordsMask(levelComponent);
+ _isValid = true;
}
bool IsValid() const
@@ -295,32 +308,6 @@ private:
LPCWSTR End;
};
- void Parse(LPWSTR configString)
- {
- if (configString == nullptr || *configString == L'\0')
- {
- _provider = W("*");
- _enabledKeywords = (ULONGLONG)(-1);
- _level = TRACE_LEVEL_VERBOSE;
- return;
- }
-
- auto providerComponent = GetNextComponentString(configString);
- _provider = ParseProviderName(providerComponent);
- if (_provider == nullptr)
- {
- _isValid = false;
- return;
- }
-
- auto keywordsComponent = GetNextComponentString(providerComponent.End + 1);
- _enabledKeywords = ParseEnabledKeywordsMask(keywordsComponent);
-
- auto levelComponent = GetNextComponentString(keywordsComponent.End + 1);
- _level = ParseEnabledKeywordsMask(levelComponent);
- _isValid = true;
- }
-
ComponentSpan GetNextComponentString(LPCWSTR start) const
{
static WCHAR ComponentDelimiter = W(':');
@@ -377,7 +364,7 @@ class XplatEventLoggerController
{
public:
- static void Initialize(XplatEventLoggerConfiguration const &config)
+ static void UpdateProviderContext(XplatEventLoggerConfiguration const &config)
{
if (!config.IsValid())
{
@@ -404,6 +391,16 @@ public:
}
}
+ static void ActivateAllKeywordsOfAllProviders()
+ {
+ for (LTTNG_TRACE_CONTEXT * const provider : ALL_LTTNG_PROVIDERS_CONTEXT)
+ {
+ provider->EnabledKeywordsBitmask = (ULONGLONG)(-1);
+ provider->Level = TRACE_LEVEL_VERBOSE;
+ provider->IsEnabled = true;
+ }
+ }
+
private:
static LTTNG_TRACE_CONTEXT * const GetProvider(LPCWSTR providerName)
@@ -418,16 +415,6 @@ private:
}
return nullptr;
}
-
- static void ActivateAllKeywordsOfAllProviders()
- {
- for (LTTNG_TRACE_CONTEXT * const provider : ALL_LTTNG_PROVIDERS_CONTEXT)
- {
- provider->EnabledKeywordsBitmask = (ULONGLONG)(-1);
- provider->Level = TRACE_LEVEL_VERBOSE;
- provider->IsEnabled = true;
- }
- }
};
class XplatEventLogger
@@ -462,6 +449,17 @@ public:
return false;
}
+
+ /*
+ This method is where COMPlus_LTTngConfig environment variable is parsed and is registered with the runtime provider
+ context structs generated by src/scripts/genEventing.py.
+ It expects the environment variable to look like:
+ provider:keywords:level,provider:keywords:level
+ (Notice the "arguments" part is missing compared to EventPipe configuration)
+
+ Ex)
+ Microsoft-Windows-DotNETRuntime:deadbeefdeadbeef:4,Microsoft-Windows-DotNETRuntimePrivate:deafbeefdeadbeef:5
+ */
static void InitializeLogger()
{
if (!IsEventLoggingEnabled())
@@ -471,11 +469,26 @@ public:
LPWSTR xplatEventConfig = NULL;
CLRConfig::GetConfigValue(CLRConfig::INTERNAL_LTTngConfig, &xplatEventConfig);
-
auto configuration = XplatEventLoggerConfiguration();
- configuration.Initialize(xplatEventConfig);
+ auto configToParse = xplatEventConfig;
- XplatEventLoggerController::Initialize(configuration);
+ if (configToParse == nullptr || *configToParse == L'\0')
+ {
+ XplatEventLoggerController::ActivateAllKeywordsOfAllProviders();
+ return;
+ }
+ while (configToParse != nullptr)
+ {
+ static WCHAR comma = W(',');
+ auto end = wcschr(configToParse, comma);
+ configuration.Parse(configToParse);
+ XplatEventLoggerController::UpdateProviderContext(configuration);
+ if (end == nullptr)
+ {
+ break;
+ }
+ configToParse = end + 1;
+ }
}
};