shirou_gopsutil/cpu.go

25 lines
572 B
Go
Raw Normal View History

2014-04-22 08:44:22 +08:00
package gopsutil
2014-04-18 15:34:47 +08:00
import (
"runtime"
)
type CPU_TimesStat struct {
2014-04-24 16:20:12 +08:00
Cpu string `json:"cpu"`
2014-04-24 15:15:57 +08:00
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"`
Guest_nice float32 `json:"guest_nice"`
Stolen float32 `json:"stolen"`
2014-04-18 15:34:47 +08:00
}
func Cpu_counts(logical bool) (int, error) {
2014-04-18 15:34:47 +08:00
return runtime.NumCPU(), nil
}