Documentation ¶
Index ¶
- Variables
- func GetBrandName() string
- func GetCpuId() (string, error)
- func GetCurrentProcessUsagePercent() (float64, error)
- func GetFamily() int
- func GetFrequency() int64
- func GetLogicalCores() int
- func GetModel() int
- func GetPhysicalCores() int
- func GetProcessUsagePercent(pid int32) (float64, error)
- func GetThreadsPerCore() int
- func GetUsagePercent() (float64, error)
- func GetVendorID() cpuid.Vendor
- func GetVendorString() string
- func HasFeature(id cpuid.FeatureID) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var GetCpuNumber func() int = runtime.NumCPU
GetCpuNumber returns the number of logical CPUs usable by the current process.
View Source
var GetFeatureSet func() []string = cpuid.CPU.FeatureSet
GetFeatureSet 获取CPU支持的指令集s.
Linux命令: cat /proc/cpuinfo
View Source
var InVirtualMachine func() bool = cpuid.CPU.VM
InVirtualMachine 是否在虚拟机中?
Functions ¶
func GetCpuId ¶
GetCpuId
PS: cpu.Info() 目前仅支持Windows环境,不支持:Mac环境(M1)、Linux环境.
Linux下用命令查看CPU ID: https://blog.csdn.net/benwdm/article/details/84685292
func GetCurrentProcessUsagePercent ¶
GetCurrentProcessUsagePercent 获取 当前进程 的CPU使用百分比.
PS: 类似Linux命令: top -p ${pid}
func GetFrequency ¶
func GetFrequency() int64
func GetLogicalCores ¶
func GetLogicalCores() int
func GetPhysicalCores ¶
func GetPhysicalCores() int
func GetProcessUsagePercent ¶
GetProcessUsagePercent 获取 指定进程 的CPU使用百分比.
func GetThreadsPerCore ¶
func GetThreadsPerCore() int
func GetVendorID ¶
func GetVendorID() cpuid.Vendor
func HasFeature ¶
func HasFeature(id cpuid.FeatureID) bool
HasFeature CPU是否支持特定指令集?
@param id e.g. cpuid.AVX
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.