Skip to content

Commit

Permalink
fix: cpu usage 100 percent
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Jan 13, 2023
1 parent 1e1e85c commit 74a712a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/perfmonUtil/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func getCPU(client *adb.Device, stats *entity.SystemInfo) (err error) {
var cpuNowTime = float32(nowCPU.User + nowCPU.Nice + nowCPU.System + nowCPU.Iowait + nowCPU.Irq + nowCPU.SoftIrq)
var cpuPreTime = float32(preCPU.User + preCPU.Nice + preCPU.System + preCPU.Iowait + preCPU.Irq + preCPU.SoftIrq)

cpu.Usage = (cpuNowTime - cpuPreTime) / ((cpuNowTime + float32(nowCPU.Idle)) - (cpuPreTime + float32(preCPU.Idle)))
cpu.Usage = (cpuNowTime - cpuPreTime) / ((cpuNowTime + float32(nowCPU.Idle)) - (cpuPreTime + float32(preCPU.Idle))) * 100
stats.CPU[fields[0]] = cpu
}
}
Expand Down

0 comments on commit 74a712a

Please sign in to comment.