Rename load to load average.

Load is now LoadAverage. Also added comments about smoothing interval.
This commit is contained in:
Rohit Jnagal 2015-01-27 23:14:46 +00:00
parent bc1b58eb26
commit 667a8e0fd1
4 changed files with 7 additions and 5 deletions

View File

@ -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 {

View File

@ -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) {

View File

@ -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()

View File

@ -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)
}
}