hwinfo

package
v0.0.0-...-6c4fd92 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: NIST-PD-fallback Imports: 7 Imported by: 0

Documentation

Overview

Package hwinfo gathers hardware information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoreInfo

type CoreInfo struct {
	ID          int // logical core ID
	NumaSocket  int // NUMA socket number
	PhysicalKey int // physical core key, same value for hyper-threads on a physical core
}

CoreInfo describes a logical CPU core.

type Cores

type Cores []CoreInfo

Cores contains information about CPU cores.

func (Cores) ByID

func (cores Cores) ByID() (m map[int]CoreInfo)

ByID converts to map[ID]CoreInfo.

func (Cores) ByNumaSocket

func (cores Cores) ByNumaSocket() (m map[int]Cores)

ByNumaSocket classifies cores as map[NumaSocket]Cores.

func (Cores) ListPrimary

func (cores Cores) ListPrimary() []int

ListPrimary returns a list of logical cores that are the first logical core in each physical core.

func (Cores) ListSecondary

func (cores Cores) ListSecondary() []int

ListSecondary returns a list of logical cores that are not in ListPrimary().

func (Cores) MaxNumaSocket

func (cores Cores) MaxNumaSocket() int

MaxNumaSocket determines the maximum NUMA socket.

type Provider

type Provider interface {
	// Cores provides information about CPU cores.
	Cores() Cores
}

Provider provides information about hardware.

var Default Provider = &procinfoProvider{}

Default is the default Provider implementation.

Jump to

Keyboard shortcuts

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