From 3c1997db1614727e0c111efddb01224ac8779826 Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Tue, 11 Jun 2019 10:58:05 -0700 Subject: [PATCH] Refactor one-time ETL rundown event firing (#24993) - Moved the `RuntimeInformation` and `TieredCompilation/Settings` events to fire on rundown on attach/detach --- src/inc/eventtracebase.h | 1 + src/vm/eventpipe.cpp | 3 --- src/vm/eventtrace.cpp | 33 +++++++++++++++++++++++++-------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h index 43cc99a..3247348 100644 --- a/src/inc/eventtracebase.h +++ b/src/inc/eventtracebase.h @@ -461,6 +461,7 @@ namespace ETW static VOID ProcessShutdown(); static VOID ModuleRangeRundown(); + static VOID SendOneTimeRundownEvents(); static VOID StartRundown(); static VOID EndRundown(); static VOID EnumerateForCaptureState(); diff --git a/src/vm/eventpipe.cpp b/src/vm/eventpipe.cpp index 0b1ae11..d128759 100644 --- a/src/vm/eventpipe.cpp +++ b/src/vm/eventpipe.cpp @@ -449,9 +449,6 @@ void EventPipe::DisableInternal(EventPipeSessionID id, EventPipeProviderCallback // Log the process information event. LogProcessInformationEvent(*s_pEventSource); - // Log the runtime information event. - ETW::InfoLog::RuntimeInformation(ETW::InfoLog::InfoStructs::Normal); - // Disable pSession tracing. s_config.Disable(*pSession, pEventPipeProviderCallbackDataQueue); diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index 400fdf2..46c1e9c 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -3833,6 +3833,27 @@ VOID ETW::EnumerationLog::ModuleRangeRundown() /****************************************************************************/ +// Called when ETW is turned ON or OFF on an existing process, to send +// events that are only sent once per rundown +/****************************************************************************/ +VOID ETW::EnumerationLog::SendOneTimeRundownEvents() +{ + CONTRACTL { + NOTHROW; + GC_TRIGGERS; + } CONTRACTL_END; + + // Fire the runtime information event + ETW::InfoLog::RuntimeInformation(ETW::InfoLog::InfoStructs::Callback); + + if (ETW::CompilationLog::TieredCompilation::Rundown::IsEnabled() && g_pConfig->TieredCompilation()) + { + ETW::CompilationLog::TieredCompilation::Rundown::SendSettings(); + } +} + + +/****************************************************************************/ /* Called when ETW is turned ON on an existing process */ /****************************************************************************/ VOID ETW::EnumerationLog::StartRundown() @@ -3844,6 +3865,8 @@ VOID ETW::EnumerationLog::StartRundown() EX_TRY { + SendOneTimeRundownEvents(); + BOOL bIsPerfTrackRundownEnabled = ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNPERFTRACK_KEYWORD); @@ -4016,6 +4039,8 @@ VOID ETW::EnumerationLog::EndRundown() EX_TRY { + SendOneTimeRundownEvents(); + BOOL bIsPerfTrackRundownEnabled = ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_RUNDOWNPERFTRACK_KEYWORD); @@ -4461,14 +4486,6 @@ extern "C" if(g_fEEStarted && !g_fEEShutDown && bIsRundownTraceHandle) { - // Fire the runtime information event - ETW::InfoLog::RuntimeInformation(ETW::InfoLog::InfoStructs::Callback); - - if (ETW::CompilationLog::TieredCompilation::Rundown::IsEnabled() && g_pConfig->TieredCompilation()) - { - ETW::CompilationLog::TieredCompilation::Rundown::SendSettings(); - } - // Start and End Method/Module Rundowns // Used to fire events that we missed since we started the controller after the process started // flags for immediate start rundown -- 2.7.4