summaryrefslogtreecommitdiff
path: root/src/vm/eventpipe.cpp
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2018-10-05 16:44:15 -0700
committerGitHub <noreply@github.com>2018-10-05 16:44:15 -0700
commit457148064c836daa746542f1559b7958d6420c22 (patch)
tree637c49662f44b301afc0f3450055a7c72fd00119 /src/vm/eventpipe.cpp
parent27c848e37e9998142b60e776cf5b5d08a3543fe1 (diff)
downloadcoreclr-457148064c836daa746542f1559b7958d6420c22.tar.gz
coreclr-457148064c836daa746542f1559b7958d6420c22.tar.bz2
coreclr-457148064c836daa746542f1559b7958d6420c22.zip
Enable Config-File Based Control of EventPipe (#20238)
Diffstat (limited to 'src/vm/eventpipe.cpp')
-rw-r--r--src/vm/eventpipe.cpp124
1 files changed, 0 insertions, 124 deletions
diff --git a/src/vm/eventpipe.cpp b/src/vm/eventpipe.cpp
index df6728e046..882fad5c0c 100644
--- a/src/vm/eventpipe.cpp
+++ b/src/vm/eventpipe.cpp
@@ -830,130 +830,6 @@ CrstStatic* EventPipe::GetLock()
return &s_configCrst;
}
-void EventPipe::GetConfigurationFromEnvironment(SString &outputPath, EventPipeSession *pSession)
-{
- LIMITED_METHOD_CONTRACT;
-
- // Set the output path if specified.
- CLRConfigStringHolder wszOutputPath(CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EventPipeOutputFile));
- if(wszOutputPath != NULL)
- {
- outputPath.Set(wszOutputPath);
- }
-
- // Read the the provider configuration from the environment if specified.
- CLRConfigStringHolder wszConfig(CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EventPipeConfig));
- if(wszConfig == NULL)
- {
- pSession->EnableAllEvents();
- return;
- }
-
- size_t len = wcslen(wszConfig);
- if(len <= 0)
- {
- pSession->EnableAllEvents();
- return;
- }
-
- // Parses a string with the following format:
- //
- // ProviderName:Keywords:Level[,]*
- //
- // For example:
- //
- // Microsoft-Windows-DotNETRuntime:0xCAFEBABE:2,Microsoft-Windows-DotNETRuntimePrivate:0xDEADBEEF:1
- //
- // Each provider configuration is separated by a ',' and each component within the configuration is
- // separated by a ':'.
-
- const WCHAR ProviderSeparatorChar = ',';
- const WCHAR ComponentSeparatorChar = ':';
- size_t index = 0;
- WCHAR *pProviderName = NULL;
- UINT64 keywords = 0;
- EventPipeEventLevel level = EventPipeEventLevel::Critical;
-
- while(index < len)
- {
- WCHAR * pCurrentChunk = &wszConfig[index];
- size_t currentChunkStartIndex = index;
- size_t currentChunkEndIndex = 0;
-
- // Find the next chunk.
- while(index < len && wszConfig[index] != ProviderSeparatorChar)
- {
- index++;
- }
- currentChunkEndIndex = index++;
-
- // Split the chunk into components.
- size_t chunkIndex = currentChunkStartIndex;
-
- // Get the provider name.
- size_t provNameStartIndex = chunkIndex;
- size_t provNameEndIndex = currentChunkEndIndex;
-
- while(chunkIndex < currentChunkEndIndex && wszConfig[chunkIndex] != ComponentSeparatorChar)
- {
- chunkIndex++;
- }
- provNameEndIndex = chunkIndex++;
-
- size_t provNameLen = provNameEndIndex - provNameStartIndex;
- pProviderName = new WCHAR[provNameLen+1];
- memcpy(pProviderName, &wszConfig[provNameStartIndex], provNameLen*sizeof(WCHAR));
- pProviderName[provNameLen] = '\0';
-
- // Get the keywords.
- size_t keywordsStartIndex = chunkIndex;
- size_t keywordsEndIndex = currentChunkEndIndex;
-
- while(chunkIndex < currentChunkEndIndex && wszConfig[chunkIndex] != ComponentSeparatorChar)
- {
- chunkIndex++;
- }
- keywordsEndIndex = chunkIndex++;
-
- size_t keywordsLen = keywordsEndIndex - keywordsStartIndex;
- WCHAR *wszKeywords = new WCHAR[keywordsLen+1];
- memcpy(wszKeywords, &wszConfig[keywordsStartIndex], keywordsLen*sizeof(WCHAR));
- wszKeywords[keywordsLen] = '\0';
- keywords = _wcstoui64(wszKeywords, NULL, 16);
- delete[] wszKeywords;
- wszKeywords = NULL;
-
- // Get the level.
- size_t levelStartIndex = chunkIndex;
- size_t levelEndIndex = currentChunkEndIndex;
-
- while(chunkIndex < currentChunkEndIndex && wszConfig[chunkIndex] != ComponentSeparatorChar)
- {
- chunkIndex++;
- }
- levelEndIndex = chunkIndex++;
-
- size_t levelLen = levelEndIndex - levelStartIndex;
- WCHAR *wszLevel = new WCHAR[levelLen+1];
- memcpy(wszLevel, &wszConfig[levelStartIndex], levelLen*sizeof(WCHAR));
- wszLevel[levelLen] = '\0';
- level = (EventPipeEventLevel) wcstoul(wszLevel, NULL, 16);
- delete[] wszLevel;
- wszLevel = NULL;
-
- // Add a new EventPipeSessionProvider.
- EventPipeSessionProvider *pSessionProvider = new EventPipeSessionProvider(pProviderName, keywords, level);
- pSession->AddSessionProvider(pSessionProvider);
-
- // Free the provider name string.
- if(pProviderName != NULL)
- {
- delete[] pProviderName;
- pProviderName = NULL;
- }
- }
-}
-
void EventPipe::SaveCommandLine(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR *argv)
{
CONTRACTL