mirror of
https://github.com/tw93/Mole.git
synced 2026-02-08 19:04:20 +00:00
Go code formatting optimization
This commit is contained in:
@@ -32,7 +32,7 @@ func collectCPU() (CPUStatus, error) {
|
||||
}
|
||||
|
||||
// Two-call pattern for more reliable CPU usage.
|
||||
cpu.Percent(0, true)
|
||||
warmUpCpu()
|
||||
time.Sleep(cpuSampleInterval)
|
||||
percents, err := cpu.Percent(0, true)
|
||||
var totalPercent float64
|
||||
@@ -255,3 +255,7 @@ func fallbackCPUUtilization(logical int) (float64, []float64, error) {
|
||||
}
|
||||
return avg, perCore, nil
|
||||
}
|
||||
|
||||
func warmUpCpu() {
|
||||
cpu.Percent(0, true) //nolint:errcheck
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user