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)
| 422 | // The decay used ensures that the load will stabilize on a new constant value within |
| 423 | // 10 seconds. |
| 424 | func (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 | |
| 432 | func (cd *containerData) updateLoadD(newLoad uint64) { |
| 433 | if cd.loadDAvg < 0 { |