Created
May 27, 2019 12:00
-
-
Save chrisnas/4cf77c2d75d101be23cdc95036f761b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This event provides the size of each generation after the collection | |
// Note: last event for non background GC (will be GCGlobalHeapHistory for background gen 2) | |
private void OnGcHeapStats(EventWrittenEventArgs e) | |
{ | |
var currentGC = GetCurrentGC(_gcInfo); | |
if (currentGC == null) | |
return; | |
currentGC.Heaps.Gen0Size = (long)GetFieldValue<ulong>(e, "GenerationSize0"); | |
currentGC.Heaps.Gen1Size = (long)GetFieldValue<ulong>(e, "GenerationSize1"); | |
currentGC.Heaps.Gen2Size = (long)GetFieldValue<ulong>(e, "GenerationSize2"); | |
currentGC.Heaps.LOHSize = (long)GetFieldValue<ulong>(e, "GenerationSize3"); | |
// this is the last event for non background collections during a background gen2 collections | |
if ( | |
(_gcInfo.CurrentBGC != null) && | |
(currentGC.Generation < 2) | |
) | |
{ | |
GcEvents?.Invoke(this, BuildGcArgs(currentGC)); | |
_gcInfo.GCInProgress = null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment