cpu

package
v0.0.0-...-4316413 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 8 Imported by: 13

Documentation

Overview

Package cpu regroups collecting information about the CPU

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cpu

type Cpu struct {
	// VendorId the CPU vendor ID
	VendorId string
	// ModelName the CPU model
	ModelName string
	// CpuCores the number of cores for the CPU
	CpuCores uint64
	// CpuLogicalProcessors the number of logical core for the CPU
	CpuLogicalProcessors uint64
	// Mhz the frequency for the CPU (Not available on ARM)
	Mhz float64
	// CacheSizeBytes the cache size for the CPU (Linux only)
	CacheSizeBytes uint64
	// Family the CPU family
	Family string
	// Model the CPU model name
	Model string
	// Stepping the CPU stepping
	Stepping string

	// CpuPkgs the CPU pkg count (Windows only)
	CpuPkgs uint64
	// CpuNumaNodes the CPU numa node count (Windows only)
	CpuNumaNodes uint64
	// CacheSizeL1Bytes the CPU L1 cache size (Windows only)
	CacheSizeL1Bytes uint64
	// CacheSizeL2Bytes the CPU L2 cache size (Windows only)
	CacheSizeL2Bytes uint64
	// CacheSizeL3 the CPU L3 cache size (Windows only)
	CacheSizeL3Bytes uint64
}

Cpu holds metadata about the host CPU

func Get

func Get() (*Cpu, []string, error)

Get returns a CPU struct already initialized, a list of warnings and an error. The method will try to collect as much metadata as possible, an error is returned if nothing could be collected. The list of warnings contains errors if some metadata could not be collected.

func (*Cpu) Collect

func (cpu *Cpu) Collect() (result interface{}, err error)

Collect collects the CPU information. Returns an object which can be converted to a JSON or an error if nothing could be collected. Tries to collect as much information as possible.

func (*Cpu) Name

func (cpu *Cpu) Name() string

Name returns the name of the package

Jump to

Keyboard shortcuts

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