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

Conversation

brianrob
Copy link
Member

Fixes #15494.

Modifies EventSource to be able to concurrently write to both ETW and EventPipe. This is done by creating two EventProvider objects - one for ETW and the other for EventPipe and using them both when writing events.

NOTE: The change to EventSourceTrace.cs is just to put the EventSource in a using block so that we test disposal of the EventSource. The diff on GitHub shows much more of a change than was actually made due to whitespace differences.

@brianrob
Copy link
Member Author

@dotnet-bot test OSX10.12 x64 Checked Innerloop Build and Test

Copy link

@vancem vancem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks OK. Can you add some testing where both EventPipe and ETW are turned on at the same time (and are subscribing to overlapping sets of events and are fiddling with their controls (and showing that it does not affect the other).

#endif // FEATURE_MANAGED_ETW

if (m_Dispatchers != null && m_eventData[eventId].EnabledForAnyListener)
if (m_Dispatchers != null && m_eventData[eventId].EnabledForAnyListener)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, this indentation is off (tabs vs spaces?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

if (m_provider != null)
m_eventData[eventId].EnabledForETW = value;
if (m_etwProvider != null)
m_eventData[eventId].EnabledForBlobSerializedListeners = value;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where we set EnabledForBlobSerializedListeners to true for the EventPipe case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per our offline conversation, I have fixed this by having a boolean for each source (EventPipe and ETW) so that disabling one does not disable the other.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also added a test to cover this case.

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

{
ThrowEventSourceException(eventName);
}
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be just else if (not an extra if nested inside else block)

@brianrob
Copy link
Member Author

brianrob commented Jun 4, 2018

Thanks @adamsitnik and @vancem for the reviews.

Note, I have also validated EventSource tests in CoreFX are passing with these changes.

@brianrob brianrob merged commit 6238c4f into dotnet:master Jun 4, 2018
@brianrob brianrob deleted the windows_eventsource_eventpipe branch June 4, 2018 17:26
dotnet-bot pushed a commit to dotnet/corert that referenced this pull request Jun 4, 2018
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
brianrob added a commit to dotnet/corert that referenced this pull request Jun 4, 2018
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
dotnet-bot pushed a commit to dotnet/corefx that referenced this pull request Jun 7, 2018
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
brianrob added a commit to dotnet/corefx that referenced this pull request Jun 7, 2018
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
brianrob added a commit to brianrob/coreclr that referenced this pull request Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants