public EventTime GetEventTime(EventWrittenEventArgs e) { var key = $"{_prefix}_{_extractDataIdFunc(e)}"; if (e.EventId == _startEventId) { _memoryCache.Set(key, e.TimeStamp, DefaultCacheDuration); return(EventTime.Start); } if (e.EventId == _endEventId) { if (_memoryCache.TryGetValue(key, out DateTime timeStamp)) { var eventTime = new EventTime(e.TimeStamp - timeStamp); _memoryCache.Remove(key); return(eventTime); } return(EventTime.FinalWithoutDuration); } return(EventTime.Unrecognized); }
public bool Equals(EventTime other) { return(_eventTimeType == other._eventTimeType && Duration == other.Duration); }