shirou_gopsutil/cpu.go

25 lines
548 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-18 15:34:47 +08:00
Cpu string `json:"cpu"`
User uint64 `json:"user"`
System uint64 `json:"system"`
Idle uint64 `json:"idle"`
Nice uint64 `json:"nice"`
Iowait uint64 `json:"iowait"`
Irq uint64 `json:"irq"`
Softirq uint64 `json:"softirq"`
Steal uint64 `json:"steal"`
Guest uint64 `json:"guest"`
Guest_nice uint64 `json:"guest_nice"`
Stolen uint64 `json:"stolen"`
}
func Cpu_counts() (int, error) {
2014-04-18 15:34:47 +08:00
return runtime.NumCPU(), nil
}