コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 private static double P99Time(Measurements[] measurements)
 {
     if (measurements == null || measurements.Length == 0) return 0;
     return BottomPercent(measurements, 1).Select(m => m.Time).LastOrDefault();
 }
コード例 #4
0
 private static double MinTime(Measurements[] measurements)
 {
     if (measurements == null || measurements.Length == 0) return 0;
     return measurements.Min(m => m.Time);
 }
コード例 #5
0
 private static int AverageSize(Measurements[] measurements)
 {
     if (measurements == null || measurements.Length == 0) return 0;
     return (int) measurements.Average(m => m.Size);
 }