Rename load to load average.
Load is now LoadAverage. Also added comments about smoothing interval.
This commit is contained in:
parent
bc1b58eb26
commit
667a8e0fd1
@ -199,7 +199,9 @@ type CpuStats struct {
|
||||
} `json:"usage"`
|
||||
// Smoothed average of number of runnable threads x 1000.
|
||||
// We multiply by thousand to avoid using floats, but preserving precision.
|
||||
Load int32 `json:"load"`
|
||||
// Load is smoothed over the last 10 seconds. Instantaneous value can be read
|
||||
// from LoadStats.NrRunning.
|
||||
LoadAverage int32 `json:"load_average"`
|
||||
}
|
||||
|
||||
type PerDiskStats struct {
|
||||
|
@ -47,7 +47,7 @@ func checkCpuStats(t *testing.T, stat info.CpuStats) {
|
||||
}
|
||||
inDelta(t, stat.Usage.Total, totalUsage, uint64((5 * time.Millisecond).Nanoseconds()), "Per-core CPU usage")
|
||||
inDelta(t, stat.Usage.Total, stat.Usage.User+stat.Usage.System, uint64((500 * time.Millisecond).Nanoseconds()), "User + system CPU usage")
|
||||
assert.Equal(0, stat.Load, "Non-zero load is unexpected as it is currently unset. Do we need to update the test?")
|
||||
// TODO(rjnagal): Add verification for cpu load.
|
||||
}
|
||||
|
||||
func checkMemoryStats(t *testing.T, stat info.MemoryStats) {
|
||||
|
@ -265,7 +265,7 @@ func (c *containerData) updateStats() error {
|
||||
stats.TaskStats = loadStats
|
||||
c.updateLoad(loadStats.NrRunning)
|
||||
// convert to 'milliLoad' to avoid floats and preserve precision.
|
||||
stats.Cpu.Load = int32(c.loadAvg * 1000)
|
||||
stats.Cpu.LoadAverage = int32(c.loadAvg * 1000)
|
||||
}
|
||||
}
|
||||
ref, err := c.handler.ContainerReference()
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
func createStats(id int32) *info.ContainerStats {
|
||||
return &info.ContainerStats{
|
||||
Cpu: info.CpuStats{
|
||||
Load: id,
|
||||
LoadAverage: id,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,7 @@ func expectElements(t *testing.T, sb *StatsBuffer, expected []int32) {
|
||||
return
|
||||
}
|
||||
for i, el := range res {
|
||||
if el.Cpu.Load != expected[i] {
|
||||
if el.Cpu.LoadAverage != expected[i] {
|
||||
t.Errorf("Expected elements %v, got %v", expected, res)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user