Documentation
¶
Index ¶
- Constants
- func ParseFileEntries(path string, values map[string]interface{}, pickFn PickEntryFn) error
- type CPU
- type CPUFreq
- type CPUPackage
- type Cache
- type CacheType
- type DiscoveryFlag
- type ID
- type IDSet
- func (s IDSet) Add(ids ...ID)
- func (s IDSet) CPUSet() cpuset.CPUSet
- func (s IDSet) Clone() IDSet
- func (s IDSet) Del(ids ...ID)
- func (s IDSet) Has(ids ...ID) bool
- func (s IDSet) MarshalJSON() ([]byte, error)
- func (s IDSet) Members() []ID
- func (s IDSet) Size() int
- func (s IDSet) SortedMembers() []ID
- func (s IDSet) String() string
- func (s IDSet) StringWithSeparator(args ...string) string
- func (s *IDSet) UnmarshalJSON(data []byte) error
- type MemInfo
- type MemoryType
- type Node
- type PickEntryFn
- type System
Constants ¶
const ( M = (int64(1) << 20) G = (int64(1) << 30) T = (int64(1) << 40) )
unit multipliers
const (
// SysfsRootPath is the mount path of sysfs.
SysfsRootPath = "/sys"
)
Variables ¶
This section is empty.
Functions ¶
func ParseFileEntries ¶
func ParseFileEntries(path string, values map[string]interface{}, pickFn PickEntryFn) error
ParseFileEntries parses a sysfs files for the given entries.
Types ¶
type CPU ¶
type CPU interface {
ID() ID
PackageID() ID
DieID() ID
NodeID() ID
CoreID() ID
ThreadCPUSet() cpuset.CPUSet
BaseFrequency() uint64
FrequencyRange() CPUFreq
Online() bool
Isolated() bool
SetFrequencyLimits(min, max uint64) error
}
CPU is a CPU core.
type CPUFreq ¶
type CPUFreq struct {
// contains filtered or unexported fields
}
CPUFreq is a CPU frequency scaling range
type CPUPackage ¶
type CPUPackage interface {
ID() ID
CPUSet() cpuset.CPUSet
DieIDs() []ID
NodeIDs() []ID
DieNodeIDs(ID) []ID
DieCPUSet(ID) cpuset.CPUSet
}
CPUPackage is a physical package (a collection of CPUs).
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache has details about cache.
type DiscoveryFlag ¶
type DiscoveryFlag uint
DiscoveryFlag controls what hardware details to discover.
const ( // DiscoverCPUTopology requests discovering CPU topology details. DiscoverCPUTopology DiscoveryFlag = 1 << iota // DiscoverMemTopology requests discovering memory topology details. DiscoverMemTopology // DiscoverCache requests discovering CPU cache details. DiscoverCache // DiscoverNone is the zero value for discovery flags. DiscoverNone DiscoveryFlag = 0 // DiscoverAll requests full supported discovery. DiscoverAll DiscoveryFlag = 0xffffffff // DiscoverDefault is the default set of discovery flags. DiscoverDefault DiscoveryFlag = (DiscoverCPUTopology | DiscoverMemTopology) )
type ID ¶
type ID int
ID is nn integer id, used to identify packages, CPUs, nodes, etc.
const ( // Unknown represents an unknown id. Unknown ID = -1 )
type IDSet ¶
type IDSet map[ID]struct{}
IDSet is an unordered set of integer ids.
func FromCPUSet ¶
FromCPUSet returns an id set corresponding to a cpuset.CPUSet.
func NewIDSetFromIntSlice ¶
NewIDSetFromIntSlice creates a new unordered set from an integer slice.
func (IDSet) MarshalJSON ¶
MarshalJSON is the JSON marshaller for IDSet.
func (IDSet) SortedMembers ¶
SortedMembers returns all ids in the set as a sorted slice.
func (IDSet) StringWithSeparator ¶
StringWithSeparator returns the set as a string, separated with the given separator.
func (*IDSet) UnmarshalJSON ¶
UnmarshalJSON is the JSON unmarshaller for IDSet.
type MemoryType ¶
type MemoryType int
MemoryType is an enum for the Node memory
const ( // MemoryTypeDRAM means that the node has regular DRAM-type memory MemoryTypeDRAM MemoryType = iota // MemoryTypePMEM means that the node has persistent memory MemoryTypePMEM // MemoryTypeHBM means that the node has high bandwidth memory MemoryTypeHBM )
type Node ¶
type Node interface {
ID() ID
PackageID() ID
CPUSet() cpuset.CPUSet
Distance() []int
DistanceFrom(id ID) int
MemoryInfo() (*MemInfo, error)
GetMemoryType() MemoryType
HasNormalMemory() bool
}
Node represents a NUMA node.
type PickEntryFn ¶
PickEntryFn picks a given input line apart into an entry of key and value.
type System ¶
type System interface {
Discover(flags DiscoveryFlag) error
SetCpusOnline(online bool, cpus IDSet) (IDSet, error)
SetCPUFrequencyLimits(min, max uint64, cpus IDSet) error
PackageIDs() []ID
NodeIDs() []ID
CPUIDs() []ID
PackageCount() int
SocketCount() int
CPUCount() int
NUMANodeCount() int
ThreadCount() int
CPUSet() cpuset.CPUSet
Package(id ID) CPUPackage
Node(id ID) Node
CPU(id ID) CPU
Offlined() cpuset.CPUSet
Isolated() cpuset.CPUSet
}
System devices
func DiscoverSystem ¶
func DiscoverSystem(args ...DiscoveryFlag) (System, error)
DiscoverSystem performs discovery of the running systems details.
func DiscoverSystemAt ¶
func DiscoverSystemAt(path string, args ...DiscoveryFlag) (System, error)
DiscoverSystemAt performs discovery of the running systems details from sysfs mounted at path.