dotnet / diagnostics

This repository contains the source code for various .NET Core runtime diagnostic tools and documents.
MIT License
1.17k stars 350 forks source link

dotnet-trace always collects rundown events #3597

Open davmason opened 1 year ago

davmason commented 1 year ago

There are situations, i.e. gc collect only, where we should not be collecting rundown events. We should provide an option to skip rundown events and update relevant profiles to not use rundown.

davmason commented 1 year ago

@dramos020 do you mind taking a look once you have time?

Maoni0 commented 1 year ago

I was chatting with @cshung about this and we do want to make sure that we can then specify specific rundown events on the commandline - there is a new GC rundown event that we want to always include in the GC related profiles.

cshung commented 1 year ago

In the case of gc-collect profile, we would like to make sure the GCSettingsRundown event to be fired through ETW::EnumerationLog::SendGCRundownEvent. I believe in order for that to happen, you need to keep to rundown enabled (so that we still have a call to ETW::EnumerationLog::EndRundown) but also make sure the keyword here can be changed so that only the GC bit is on. This probably cannot be achieved by changing dotnet-trace alone.

davmason commented 1 year ago

I think we could manage it without runtime changes by turning rundown off and manually enabling the Microsoft-Windows-DotNETRuntimeRundown provider in the gc-collect profile with just the GC keyword on. It may trigger the rundown event twice, once at session start and once at session end, but that seems acceptable to me.

Doing it by making rundown configurable would require new APIs on DiagnosticClient and a new diagnostics IPC command, and some logic in EventPipe. I'm not against those changes in general but our 8.0 release is already looking busy.