diff --git a/src/scripts/genLttngProvider.py b/src/scripts/genLttngProvider.py index 38fca2d09bb1..393ca3f4c022 100644 --- a/src/scripts/genLttngProvider.py +++ b/src/scripts/genLttngProvider.py @@ -546,7 +546,10 @@ def generateLttngFiles(etwmanifest,eventprovider_directory, dryRun): lttngimpl_file.write("#include \"" + lttngevntheadershortname + "\"\n\n") lttngimpl_file.write("""#ifndef tracepoint_enabled -#define tracepoint_enabled(provider, name) FALSE + +extern "C" bool XplatEventLoggerIsEnabled(); + +#define tracepoint_enabled(provider, name) XplatEventLoggerIsEnabled() #define do_tracepoint tracepoint #endif diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index f5f6389d89a1..ec0940074578 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -7543,3 +7543,11 @@ bool EventPipeHelper::IsEnabled(DOTNET_TRACE_CONTEXT Context, UCHAR Level, ULONG return false; } #endif // FEATURE_PERFTRACING + +#if defined(FEATURE_PAL) && defined(FEATURE_PERFTRACING) +// This is a wrapper method for LTTng. See https://github.com/dotnet/coreclr/pull/27273 for details. +extern "C" bool XplatEventLoggerIsEnabled() +{ + return XplatEventLogger::IsEventLoggingEnabled(); +} +#endif // FEATURE_PAL && FEATURE_PERFTRACING