|
|
@ -59,11 +59,23 @@ func TestCpu_times(t *testing.T) {
|
|
|
|
perCPUIdleTimeSum += pc.Idle
|
|
|
|
perCPUIdleTimeSum += pc.Idle
|
|
|
|
}
|
|
|
|
}
|
|
|
|
margin := 2.0
|
|
|
|
margin := 2.0
|
|
|
|
|
|
|
|
t.Log(cpuTotal[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if cpuTotal[0].User == 0 && cpuTotal[0].System == 0 && cpuTotal[0].Idle == 0 {
|
|
|
|
|
|
|
|
t.Error("could not get cpu values")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if cpuTotal[0].User != 0 {
|
|
|
|
assert.InEpsilon(t, cpuTotal[0].User, perCPUUserTimeSum, margin)
|
|
|
|
assert.InEpsilon(t, cpuTotal[0].User, perCPUUserTimeSum, margin)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if cpuTotal[0].System != 0 {
|
|
|
|
assert.InEpsilon(t, cpuTotal[0].System, perCPUSystemTimeSum, margin)
|
|
|
|
assert.InEpsilon(t, cpuTotal[0].System, perCPUSystemTimeSum, margin)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if cpuTotal[0].Idle != 0 {
|
|
|
|
assert.InEpsilon(t, cpuTotal[0].Idle, perCPUIdleTimeSum, margin)
|
|
|
|
assert.InEpsilon(t, cpuTotal[0].Idle, perCPUIdleTimeSum, margin)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestCpu_counts(t *testing.T) {
|
|
|
|
func TestCpu_counts(t *testing.T) {
|
|
|
|
v, err := Counts(true)
|
|
|
|
v, err := Counts(true)
|
|
|
|
skipIfNotImplementedErr(t, err)
|
|
|
|
skipIfNotImplementedErr(t, err)
|
|
|
|