public ReaderStatistics Reset() { Stopwatch prevWatch = Interlocked.Exchange(ref stopwatch, Stopwatch.StartNew()); ReaderStatistics prevStats = Interlocked.Exchange(ref stats, new ReaderStatistics()); var prevPoints = Interlocked.Exchange(ref dataPoints, new List <double>()); prevStats.Interval = prevWatch.Elapsed; if (prevPoints.Count > 0) { prevStats.NintyPercentileE2ELatency = prevPoints[(int)(prevPoints.Count * 0.9)]; } return(prevStats); }
public StatisticsTracker() { stats = new ReaderStatistics(); dataPoints = new List <double>(); stopwatch = Stopwatch.StartNew(); }