sk-matrix-project/app/wails/pkg/system/cpu.go
2023-07-15 23:29:03 +08:00

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
}