public ObservedTimingMeausrement GetMeasurementDetails() { var ret = new ObservedTimingMeausrement(); if (_measurements == null || _measurements.Count == 0) { return(ret); } var items = _measurements.ToArray(); Array.Sort(items); ret.Measurements.Add("Mean", items.Sum() / items.Length); ret.Measurements.Add("Median", items[items.Length / 2]); ret.Measurements.Add("Fastest", items[0]); for (var i = 0; i < 5; i++) { ret.Measurements.Add("Quintile " + (i + 1), items[GetPercentile(i * 20, items.Length)]); } ret.Measurements.Add("90%", items[GetPercentile(90m, items.Length)]); ret.Measurements.Add("95%", items[GetPercentile(95m, items.Length)]); ret.Measurements.Add("99%", items[GetPercentile(99m, items.Length)]); ret.Measurements.Add("99.5%", items[GetPercentile(99.5m, items.Length)]); ret.Measurements.Add("99.9%", items[GetPercentile(99.9m, items.Length)]); ret.Measurements.Add("Highest", items[items.Length - 1]); return(ret); }
public ObservedTimingMeausrement GetMeasurementDetails() { var ret = new ObservedTimingMeausrement(); if (_measurements == null || _measurements.Count == 0) return ret; var items = _measurements.ToArray(); Array.Sort(items); ret.Measurements.Add("Mean", items.Sum()/items.Length); ret.Measurements.Add("Median", items[items.Length/2]); ret.Measurements.Add("Fastest", items[0]); for (var i = 0; i < 5; i++) { ret.Measurements.Add("Quintile " + (i+1), items[GetPercentile(i * 20, items.Length)]); } ret.Measurements.Add("90%", items[GetPercentile(90m, items.Length)]); ret.Measurements.Add("95%", items[GetPercentile(95m, items.Length)]); ret.Measurements.Add("99%", items[GetPercentile(99m, items.Length)]); ret.Measurements.Add("99.5%", items[GetPercentile(99.5m, items.Length)]); ret.Measurements.Add("99.9%", items[GetPercentile(99.9m, items.Length)]); ret.Measurements.Add("Highest", items[items.Length - 1]); return ret; }