Created
May 27, 2019 11:58
-
-
Save chrisnas/5637fa18c0ed749505b45b7c7e8776dc 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
private void OnGcRestartEEEnd(EventWrittenEventArgs e) | |
{ | |
var currentGC = GetCurrentGC(_gcInfo); | |
if (currentGC == null) | |
{ | |
// this should never happen, except if we are unlucky to have missed a GCStart event | |
return; | |
} | |
// compute suspension time | |
double suspensionDuration = 0; | |
if (_gcInfo.SuspensionStart.HasValue) | |
{ | |
suspensionDuration = (e.TimeStamp - _gcInfo.SuspensionStart.Value).TotalMilliseconds; | |
_gcInfo.SuspensionStart = null; | |
} | |
else | |
{ | |
// bad luck: a xxxBegin event has been missed | |
} | |
currentGC.PauseDuration += suspensionDuration; | |
// could be the end of a gen0/gen1 or of a non concurrent gen2 GC | |
if ( | |
(currentGC.Generation < 2) || | |
(currentGC.Type == GCType.NonConcurrentGC) | |
) | |
{ | |
GcEvents?.Invoke(this, BuildGcArgs(currentGC)); | |
_gcInfo.GCInProgress = null; | |
return; | |
} | |
// in case of background gen2, just need to sum the suspension time | |
// --> its end will be detected during GcGlobalHistory event | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment