Fix computing of percentiles in Density test

This commit is contained in:
Wojciech Tyczynski 2015-10-28 15:41:47 +01:00
parent 1524d7490a
commit c053ef2a31

View File

@ -63,9 +63,10 @@ func (a latencySlice) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a latencySlice) Less(i, j int) bool { return a[i].Latency < a[j].Latency } func (a latencySlice) Less(i, j int) bool { return a[i].Latency < a[j].Latency }
func extractLatencyMetrics(latencies []podLatencyData) LatencyMetric { func extractLatencyMetrics(latencies []podLatencyData) LatencyMetric {
perc50 := latencies[len(latencies)/2].Latency length := len(latencies)
perc90 := latencies[(len(latencies)*9)/10].Latency perc50 := latencies[int(math.Ceil(float64(length*50)/100))-1].Latency
perc99 := latencies[(len(latencies)*99)/100].Latency perc90 := latencies[int(math.Ceil(float64(length*90)/100))-1].Latency
perc99 := latencies[int(math.Ceil(float64(length*99)/100))-1].Latency
return LatencyMetric{Perc50: perc50, Perc90: perc90, Perc99: perc99} return LatencyMetric{Perc50: perc50, Perc90: perc90, Perc99: perc99}
} }