Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Refactor one-time ETL rundown event firing
Browse files Browse the repository at this point in the history
- Moved the `RuntimeInformation` and `TieredCompilation/Settings` events to fire on rundown on attach/detach
  • Loading branch information
kouvel committed Jun 6, 2019
1 parent 41832ce commit 4f7b31e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/inc/eventtracebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ namespace ETW

static VOID ProcessShutdown();
static VOID ModuleRangeRundown();
static VOID SendOneTimeRundownEvents();
static VOID StartRundown();
static VOID EndRundown();
static VOID EnumerateForCaptureState();
Expand Down
3 changes: 0 additions & 3 deletions src/vm/eventpipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,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_pConfig->Disable(*pSession, pEventPipeProviderCallbackDataQueue);
pSession->Disable();
Expand Down
33 changes: 25 additions & 8 deletions src/vm/eventtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3832,6 +3832,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 */
/****************************************************************************/
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f7b31e

Please sign in to comment.