pull/164/head
longXboy 5 years ago
parent 5f0e0dca3e
commit 2470047483
  1. 2
      pkg/stat/sys/cpu/cpu_test.go
  2. 2
      pkg/stat/sys/cpu/psutilCPU.go

@ -10,7 +10,7 @@ func Test_CPUUsage(t *testing.T) {
var stat Stat var stat Stat
ReadStat(&stat) ReadStat(&stat)
fmt.Println(stat) fmt.Println(stat)
time.Sleep(time.Millisecond * 600) time.Sleep(time.Millisecond * 2600)
for i := 0; i < 6; i++ { for i := 0; i < 6; i++ {
time.Sleep(time.Millisecond * 500) time.Sleep(time.Millisecond * 500)
ReadStat(&stat) ReadStat(&stat)

@ -23,7 +23,7 @@ func (ps *psutilCPU) Usage() (u uint64, err error) {
var percents []float64 var percents []float64
percents, err = cpu.Percent(ps.interval, false) percents, err = cpu.Percent(ps.interval, false)
if err == nil { if err == nil {
u = uint64(percents[0] * 10000000) u = uint64(percents[0] * 10)
} }
return return
} }

Loading…
Cancel
Save