Skip to content

Commit

Permalink
Remove cpu_usage_busy, this is simply 100-cpu_usage_idle
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Sep 18, 2015
1 parent 2ac5631 commit 8e72a96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions plugins/system/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,16 @@ func (s *CPUStats) Gather(acc plugins.Accumulator) error {
continue
}

usage_idle := 100 * (cts.Idle - lastCts.Idle) / totalDelta
add(acc, "usage_user", 100*(cts.User-lastCts.User)/totalDelta, tags)
add(acc, "usage_system", 100*(cts.System-lastCts.System)/totalDelta, tags)
add(acc, "usage_idle", usage_idle, tags)
add(acc, "usage_idle", 100*(cts.Idle-lastCts.Idle)/totalDelta, tags)
add(acc, "usage_nice", 100*(cts.Nice-lastCts.Nice)/totalDelta, tags)
add(acc, "usage_iowait", 100*(cts.Iowait-lastCts.Iowait)/totalDelta, tags)
add(acc, "usage_irq", 100*(cts.Irq-lastCts.Irq)/totalDelta, tags)
add(acc, "usage_softirq", 100*(cts.Softirq-lastCts.Softirq)/totalDelta, tags)
add(acc, "usage_steal", 100*(cts.Steal-lastCts.Steal)/totalDelta, tags)
add(acc, "usage_guest", 100*(cts.Guest-lastCts.Guest)/totalDelta, tags)
add(acc, "usage_guest_nice", 100*(cts.GuestNice-lastCts.GuestNice)/totalDelta, tags)
add(acc, "usage_busy", 100.0-usage_idle, tags)

}

Expand Down
3 changes: 1 addition & 2 deletions plugins/system/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestSystemStats_GenerateStats(t *testing.T) {
require.NoError(t, err)

numCPUPoints = len(acc.Points) - (preCPUPoints + numCPUPoints)
expectedCPUPoints = 21
expectedCPUPoints = 20
assert.Equal(t, numCPUPoints, expectedCPUPoints)

assertContainsTaggedFloat(t, acc, "user", 11.4, 0, cputags)
Expand All @@ -177,7 +177,6 @@ func TestSystemStats_GenerateStats(t *testing.T) {
assertContainsTaggedFloat(t, acc, "usage_steal", 0.2301, 0.0005, cputags)
assertContainsTaggedFloat(t, acc, "usage_guest", 4.8, 0.0005, cputags)
assertContainsTaggedFloat(t, acc, "usage_guest_nice", 2.2, 0.0005, cputags)
assertContainsTaggedFloat(t, acc, "usage_busy", 21.2301, 0.0005, cputags)

err = (&DiskStats{&mps}).Gather(&acc)
require.NoError(t, err)
Expand Down

0 comments on commit 8e72a96

Please sign in to comment.