File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1818
1919package metrics
2020
21- import "github.com/shirou/gopsutil/cpu"
21+ import (
22+ "github.com/ethereum/go-ethereum/log"
23+ "github.com/shirou/gopsutil/cpu"
24+ )
2225
2326// ReadCPUStats retrieves the current CPU stats.
2427func ReadCPUStats (stats * CPUStats ) {
2528 // passing false to request all cpu times
2629 timeStats , err := cpu .Times (false )
2730 if err != nil {
28- return // TODO is it okay to just return if cpu.Times errors out? Or should it be a fatal error
31+ log .Error ("Could not read cpu stats" , "err" , err )
32+ return
2933 }
3034 // requesting all cpu times will always return an array with only one time stats entry
3135 timeStat := timeStats [0 ]
32-
33- stats .GlobalTime = int64 (timeStat .User + timeStat .Nice + timeStat .System )
34- stats .GlobalWait = int64 (timeStat .Iowait )
36+ stats .GlobalTime = int64 ((timeStat .User + timeStat .Nice + timeStat .System )* 128 )
37+ stats .GlobalWait = int64 ((timeStat .Iowait )* 128 )
3538 stats .LocalTime = getProcessCPUTime ()
3639}
You can’t perform that action at this time.
0 commit comments