metrics: disable CPU stats (gosigar) on iOS

This commit is contained in:
Péter Szilágyi
2020-03-26 11:24:01 +02:00
parent 39f502329f
commit 42e02ac03b
3 changed files with 54 additions and 12 deletions

View File

@ -16,21 +16,9 @@
package metrics
import "github.com/elastic/gosigar"
// CPUStats is the system and process CPU stats.
type CPUStats struct {
GlobalTime int64 // Time spent by the CPU working on all processes
GlobalWait int64 // Time spent by waiting on disk for all processes
LocalTime int64 // Time spent by the CPU working on this process
}
// ReadCPUStats retrieves the current CPU stats.
func ReadCPUStats(stats *CPUStats) {
global := gosigar.Cpu{}
global.Get()
stats.GlobalTime = int64(global.User + global.Nice + global.Sys)
stats.GlobalWait = int64(global.Wait)
stats.LocalTime = getProcessCPUTime()
}