MCPcopy
hub / github.com/google/cadvisor / updateLoad

Method updateLoad

lib/manager/container.go:424–430  ·  view source on GitHub ↗

Calculate new smoothed load average using the new sample of runnable threads. The decay used ensures that the load will stabilize on a new constant value within 10 seconds.

(newLoad uint64)

Source from the content-addressed store, hash-verified

422// The decay used ensures that the load will stabilize on a new constant value within
423// 10 seconds.
424func (cd *containerData) updateLoad(newLoad uint64) {
425 if cd.loadAvg < 0 {
426 cd.loadAvg = float64(newLoad) // initialize to the first seen sample for faster stabilization.
427 } else {
428 cd.loadAvg = cd.loadAvg*cd.loadDecay + float64(newLoad)*(1.0-cd.loadDecay)
429 }
430}
431
432func (cd *containerData) updateLoadD(newLoad uint64) {
433 if cd.loadDAvg < 0 {

Callers 1

updateStatsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected