1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-29 13:49:21 +08:00

31 lines
661 B
Go

package gopsutil
import (
"encoding/json"
"runtime"
)
type CPUTimesStat struct {
CPU string `json:"cpu"`
User float32 `json:"user"`
System float32 `json:"system"`
Idle float32 `json:"idle"`
Nice float32 `json:"nice"`
Iowait float32 `json:"iowait"`
Irq float32 `json:"irq"`
Softirq float32 `json:"softirq"`
Steal float32 `json:"steal"`
Guest float32 `json:"guest"`
GuestNice float32 `json:"guest_nice"`
Stolen float32 `json:"stolen"`
}
func CPUCounts(logical bool) (int, error) {
return runtime.NumCPU(), nil
}
func (c CPUTimesStat) String() string {
s, _ := json.Marshal(c)
return string(s)
}