diff options
author | John Salem <josalem@microsoft.com> | 2019-05-29 18:59:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-29 18:59:27 -0700 |
commit | cc1f8ab68e645cd46601b1df50ff644dfffc4dae (patch) | |
tree | ef884d3bddbdae04ccc8fbd7a293c6b200b03ba9 /src/pal | |
parent | 42ac1e71f77ab8e5036602b0bf673d6d6202923f (diff) | |
download | coreclr-cc1f8ab68e645cd46601b1df50ff644dfffc4dae.tar.gz coreclr-cc1f8ab68e645cd46601b1df50ff644dfffc4dae.tar.bz2 coreclr-cc1f8ab68e645cd46601b1df50ff644dfffc4dae.zip |
Add COMPlus_LTTng environment variable (#24733)
* default value is 1, and when set to 0 will disable loading LTTng.
Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
Diffstat (limited to 'src/pal')
-rw-r--r-- | src/pal/src/misc/tracepointprovider.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/pal/src/misc/tracepointprovider.cpp b/src/pal/src/misc/tracepointprovider.cpp index 8d20266688..6aa8fb5237 100644 --- a/src/pal/src/misc/tracepointprovider.cpp +++ b/src/pal/src/misc/tracepointprovider.cpp @@ -59,6 +59,16 @@ __attribute__((constructor (200))) static void PAL_InitializeTracing(void) { + int fShouldLoad = 1; + // Check if loading the LTTng providers should be disabled. + // Note: this env var is formally declared in clrconfigvalues.h, but + // this code is executed too early to use the mechanics that come with that definition. + char *disableValue = getenv("COMPlus_LTTng"); + if (disableValue != NULL) + { + fShouldLoad = strtol(disableValue, NULL, 10); + } + // Get the path to the currently executing shared object (libcoreclr.so). Dl_info info; int succeeded = dladdr((void *)PAL_InitializeTracing, &info); @@ -99,11 +109,13 @@ PAL_InitializeTracing(void) return; } - - - // Load the tracepoint provider. - // It's OK if this fails - that just means that tracing dependencies aren't available. - dlopen(tpProvPath, RTLD_NOW | RTLD_GLOBAL); + + if (fShouldLoad) + { + // Load the tracepoint provider. + // It's OK if this fails - that just means that tracing dependencies aren't available. + dlopen(tpProvPath, RTLD_NOW | RTLD_GLOBAL); + } } #endif |