-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedapi-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-GC-coreclr
Milestone
Description
Background and motivation
Today we have already exposed the total paused time as a percentage of the process time on the GetGCMemoryInfo API.
In particular, through the PauseTimePercentage field on the GCMemoryInfo struct.
This is useful, but what if I only want to numerator (i.e. the total amount of time paused in GC since the beginning of the process?). There is no way to get that value for now.
API Proposal
I am proposing to add an API on System.GC as follow:
TimeSpan System.GC.GetTotalPauseDuration()This will return the total paused duration in the GC
API Usage
...
TimeSpan start = System.GC.GetTotalPauseDuration();
// ... Perform some work ...
TimeSpan end= System.GC.GetTotalPauseDuration();
Console.WriteLine(end - start + " was spent pausing in GC");
...Alternative Designs
We have considered the alternative to add a field on the GetGCMemoryInfo API, this will also work, but if the only thing we wanted is just the total pause time, that API will carry a larger overhead than necessary.
Risks
No response
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedapi-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-GC-coreclr