cpuKit

package
v2.1.51 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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
View Source
var InVirtualMachine func() bool = cpuid.CPU.VM

InVirtualMachine 是否在虚拟机中?

Functions

func GetBrandName

func GetBrandName() string

GetBrandName CPU品牌名称

@return e.g."Apple M1 Pro"

func GetCpuId

func GetCpuId() (string, error)

GetCpuId

PS: cpu.Info() 目前仅支持Windows环境,不支持:Mac环境(M1)、Linux环境.

Linux下用命令查看CPU ID: https://blog.csdn.net/benwdm/article/details/84685292

func GetFamily added in v2.1.37

func GetFamily() int

func GetFrequency added in v2.1.37

func GetFrequency() int64

func GetLogicalCores added in v2.1.37

func GetLogicalCores() int

func GetModel added in v2.1.37

func GetModel() int

func GetPhysicalCores added in v2.1.37

func GetPhysicalCores() int

func GetThreadsPerCore added in v2.1.37

func GetThreadsPerCore() int

func GetUsage added in v2.1.37

func GetUsage() (float64, error)

GetUsage CPU使用率

PS: 耗时约1s.

e.g. () => 12.701612903175233

func GetVendorID added in v2.1.37

func GetVendorID() cpuid.Vendor

func GetVendorString added in v2.1.37

func GetVendorString() string

GetVendorString CPU供应商

@return e.g."Apple"

func SetUp added in v2.1.48

func SetUp()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL