Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update runtime providers' context object on EventPipe rundown #36733

Merged
merged 4 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/coreclr/src/vm/eventpipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,15 @@ void EventPipe::Disable(EventPipeSessionID id)
if (s_numberOfSessions > 0)
DisableInternal(id, pEventPipeProviderCallbackDataQueue);
});

#ifdef DEBUG
if (s_numberOfSessions == 0)
{
_ASSERTE(!MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context.EventPipeProvider.IsEnabled);
_ASSERTE(!MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_DOTNET_Context.EventPipeProvider.IsEnabled);
_ASSERTE(!MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_DOTNET_Context.EventPipeProvider.IsEnabled);
}
#endif
}

static void LogProcessInformationEvent(EventPipeEventSource &eventSource)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/src/vm/eventtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4267,6 +4267,7 @@ VOID EtwCallbackCommon(
{
ctxToUpdate->EventPipeProvider.Level = Level;
ctxToUpdate->EventPipeProvider.EnabledKeywordsBitmask = MatchAnyKeyword;
ctxToUpdate->EventPipeProvider.IsEnabled = ControlCode;
sywhang marked this conversation as resolved.
Show resolved Hide resolved
}

if (
Expand Down Expand Up @@ -7612,6 +7613,11 @@ bool EventPipeHelper::IsEnabled(DOTNET_TRACE_CONTEXT Context, UCHAR Level, ULONG
}
CONTRACTL_END

if (!Context.EventPipeProvider.IsEnabled)
{
return false;
}

if (Level <= Context.EventPipeProvider.Level || Context.EventPipeProvider.Level == 0)
sywhang marked this conversation as resolved.
Show resolved Hide resolved
{
return (Keyword == (ULONGLONG)0) || (Keyword & Context.EventPipeProvider.EnabledKeywordsBitmask) != 0;
Expand Down