MCPcopy Create free account
hub / github.com/zalando/skipper / stdDeviation

Function stdDeviation

loadbalancer/algorithm_test.go:500–513  ·  view source on GitHub ↗
(counters map[int]uint64)

Source from the content-addressed store, hash-verified

498}
499
500func stdDeviation(counters map[int]uint64) float64 {
501 sum := uint64(0)
502 for _, v := range counters {
503 sum += v
504 }
505 mean := float64(sum) / float64(len(counters))
506 summedDiffs := 0.0
507 for _, v := range counters {
508 diff := float64(v) - mean
509 summedDiffs += diff * diff
510 }
511 stdDev := math.Sqrt(summedDiffs / float64(len(counters)))
512 return (stdDev * 100) / mean
513}
514
515func BenchmarkRandomAlgorithm(b *testing.B) {
516 N := 10

Callers 1

measureStdDevFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…