private void OnGCEnd(EventWrittenEventArgs @event)
        {
            var timestamp = TimestampProvider(@event);

            if (timestamp == default)
            {
                return;
            }

            var endEvent = new GarbageCollectionEndEvent(
                timestamp,
                (int)GetFieldValue <uint>(@event, "Count"),
                (int)GetFieldValue <uint>(@event, "Depth"));

            lock (startEvents)
            {
                foreach (var startEvent in startEvents.EnumerateReverse())
                {
                    if (Correspond(startEvent, endEvent))
                    {
                        ReportCollectionInfo(startEvent, endEvent);
                    }
                }
            }
        }
        private void ReportCollectionInfo(GarbageCollectionStartEvent start, GarbageCollectionEndEvent end)
        {
            var info = new GarbageCollectionInfo(
                new DateTimeOffset(start.Timestamp.ToLocalTime()),
                end.Timestamp - start.Timestamp,
                start.Generation,
                start.Number,
                start.Type,
                start.Reason);

            Task.Run(() => observable.Push(info));
        }
 private bool Correspond(GarbageCollectionStartEvent start, GarbageCollectionEndEvent end)
 => start.Generation == end.Generation && start.Number == end.Number;