mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
fix cpu usage record
This commit is contained in:
parent
897c3cddcd
commit
41b331ab11
2 changed files with 4 additions and 2 deletions
|
@ -22,7 +22,9 @@ func RecordCpuUsage() {
|
|||
threadNum := runtime.GOMAXPROCS(0)
|
||||
|
||||
cpuUserUsage := (cpuTimesAfter[0].User - cpuTimesBefore[0].User) / (float64(1000*threadNum) / 1000)
|
||||
cpuUserUsage *= 100
|
||||
cpuSystemUsage := (cpuTimesAfter[0].System - cpuTimesBefore[0].System) / (float64(1000*threadNum) / 1000)
|
||||
cpuSystemUsage *= 100
|
||||
now := time.Now()
|
||||
u := cpuUsage{
|
||||
Time: now,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue