22 lines
371 B
Go
22 lines
371 B
Go
package system
|
|
|
|
import (
|
|
"github.com/shirou/gopsutil/cpu"
|
|
"time"
|
|
)
|
|
|
|
func (i *InfoUtils) GetCpuInfo() []cpu.InfoStat {
|
|
infoStats, _ := cpu.Info()
|
|
return infoStats
|
|
}
|
|
|
|
func (i *InfoUtils) GetCpuUsage() []float64 {
|
|
info, _ := cpu.Percent(time.Second, false)
|
|
return info
|
|
}
|
|
|
|
func (i *InfoUtils) GetCpuTimes() []cpu.TimesStat {
|
|
info, _ := cpu.Times(false)
|
|
return info
|
|
}
|