-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add more runtime GC counters #38851
Add more runtime GC counters #38851
Conversation
internal static extern ulong GetGenerationTimeBetweenGC(int gen); | ||
|
||
[MethodImpl(MethodImplOptions.InternalCall)] | ||
internal static extern int GetGenerationLastGCDuration(int gen); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this information is important for telemetry, should we consider putting it on GCMemoryInfo?
cc: @maoni
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCMemoryInfo already includes pause info. I don't think we want to include duration because for BGC it's not useful; for non BGC it's basically the same as pause.
the user of the GetGCMemoryInfo API would detect the GC frequency to the precision their sampling interval allows, eg if they call this API once every second and detected 2 gen0 GCs, they don't know how long exactly elapsed between the 2 GCs but they know they have 2 gen0 GCs in 1s.
the counter name says "pause time", the API says "GC duration". for BGCs, these 2 are very different. the time between BGC start and end could be long but only a small portion of it is paused. the calculation for for GC counters, since this is part of a public surface, I would strongly encourage you to find out how this will be used to decide whether you want duration or pause time. pause time for BGC is already calculated with the new GetGCMemoryInfo API implementation so if that's what you want, you can get it from there. in fact I would encourage you to see if you should get other GCs' duration from that too - that includes suspension whereas this calculation does not. do we want to expose 2 different kinds of duration? |
I think we should back up a bit. These changes have been done under a bug-fix style workflow but this is a new feature with public surface area. There may have been some confusion because past counters were added with little fanfare. I suspect the major difference is that those counters were largely replicating functionality that .NET Framework already had whereas these are novel requests that have never been subjected to much scrutiny. My suggestion is to write a doc and submit it as a PR in https://github.com/dotnet/runtime/tree/master/docs/design/features. The doc should have: Here are some things I expect will come up and hopefully get resolved in that discussion:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/RuntimeEventSource.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no comments aside from the precision issue Noah already pointed out above.
* Add more GC counters * Cleanup * Change size of last GC stats arrays from total_generation_count to max_generation * add asserts and fix error * fix typo * Fix Windows build * Remove pause time / time between GC counters as discussed in design PR * revert changes to GC for unused counters * more unnecessary changes * build fix * last bit of undoing changes * CR feedback
This adds the following new runtime GC counters:
Issues tracking this PR are #1099 and #31951.