sysinfo

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SysDevicesOnlineCPUs = "/sys/devices/system/cpu/online"
)

Variables

This section is empty.

Functions

func GetCPUResources

func GetCPUResources(resCPUs string, getCPUs func() (cpuset.CPUSet, error)) (cpuset.CPUSet, error)

func GetOnlineCPUs

func GetOnlineCPUs() (cpuset.CPUSet, error)

func GetPCIDevices

func GetPCIDevices() ([]*pci.Device, error)

func GetPCIResources

func GetPCIResources(resourceMap map[string]string, getPCIs func() ([]*pci.Device, error)) (map[string]PerNUMADevices, error)

func ResourceMappingFromString

func ResourceMappingFromString(s string) map[string]string

func ResourceMappingToString

func ResourceMappingToString(rmap map[string]string) string

func ResourceNameForDevice

func ResourceNameForDevice(dev *pci.Device, resourceMap map[string]string) (string, bool)

Types

type Config

type Config struct {
	ReservedCPUs string `json:"reservedCpus,omitempty"`
	// vendor:device -> resourcename
	ResourceMapping map[string]string `json:"resourceMapping,omitempty"`
}

func (Config) IsEmpty

func (cfg Config) IsEmpty() bool

func (Config) ToYAML

func (cfg Config) ToYAML() ([]byte, error)

func (Config) ToYAMLString

func (cfg Config) ToYAMLString() string

type PerNUMADevices

type PerNUMADevices map[int][]string

NUMA Cell -> deviceIDs

type SysInfo

type SysInfo struct {
	CPUs cpuset.CPUSet
	// resource name -> devices
	Resources map[string]PerNUMADevices
}

func NewSysinfo

func NewSysinfo(conf Config) (SysInfo, error)

func (SysInfo) String

func (si SysInfo) String() string

Jump to

Keyboard shortcuts

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