private void OnGcStop(ETWEventClrGCEnd obj) { var result = gcEventsMerger.CompleteOrNull(obj); if (result != null) { observers.OnNext(result); } }
internal GCInfo(ETWEventClrGCStart start, ETWEventClrGCEnd end) { StartTimestamp = start.Timestamp; Duration = end.Timestamp - start.Timestamp; Depth = start.Depth; Count = start.Count; // we use custom enums here because otherwise // users must reference TraceEvents directly Type = (GCType)start.Type; Reason = (GCReason)start.Reason; ProcessId = start.ProcessId; }
public GCInfo CompleteOrNull(ETWEventClrGCEnd end) { var curNode = startEvents.Last; while (curNode != null) { if (Corresponds(curNode.Value, end)) { var merged = new GCInfo(curNode.Value, end); Remove(curNode); return(merged); } curNode = curNode.Previous; } return(null); }
private static bool Corresponds(ETWEventClrGCStart start, ETWEventClrGCEnd end) { return(start.Count == end.Count && start.ProcessId == end.ProcessId && start.Depth == end.Depth); }