private static double AverageTime(Measurements[] measurements, int discardedPercent = 0)
 {
     if (measurements == null || measurements.Length == 0) return 0;
     return BottomPercent(measurements, discardedPercent).Average(m => m.Time);
 }
 private static IEnumerable<Measurements> BottomPercent(Measurements[] measurements, int discardedPercent)
 {
     if (discardedPercent == 0) return measurements;
     var take = (int) Math.Round(measurements.Length*(100 - discardedPercent)/100.0);
     return measurements.OrderBy(m => m.Time).Take(take);
 }
 private static double P99Time(Measurements[] measurements)
 {
     if (measurements == null || measurements.Length == 0) return 0;
     return BottomPercent(measurements, 1).Select(m => m.Time).LastOrDefault();
 }
 private static double MinTime(Measurements[] measurements)
 {
     if (measurements == null || measurements.Length == 0) return 0;
     return measurements.Min(m => m.Time);
 }
 private static int AverageSize(Measurements[] measurements)
 {
     if (measurements == null || measurements.Length == 0) return 0;
     return (int) measurements.Average(m => m.Size);
 }