增加获取系统cpu信息

This commit is contained in:
2021-10-12 18:38:14 +08:00
parent b8c84ebc75
commit dd6446c811
4 changed files with 98 additions and 1 deletions

32
system/define.go Normal file
View File

@ -0,0 +1,32 @@
// Package system...
//
// Description : system...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2021-10-12 5:48 下午
package system
import "github.com/shirou/gopsutil/cpu"
// CPUDetail CPU详情
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 6:20 下午 2021/10/12
type CPUDetail struct {
BaseInfo cpu.InfoStat `json:"base_info"` // 基础信息
Time []cpu.TimesStat `json:"time"` // cpu时间
Percent []float64 `json:"percent"` // 使用率
CoreCntInfo CPUCoreCnt `json:"cnt_info"` // 核心数信息
}
// CPUCoreCnt cpu核数信息
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 6:22 下午 2021/10/12
type CPUCoreCnt struct {
Logical int `json:"logical"` // 逻辑核数
Physical int `json:"physical"` // 物理核数
}