Documentation ¶
Overview ¶
The machine package contains functions that extract machine-level specs.
Index ¶
- func ContainerOsVersion() string
- func GetCPUVendorID(procInfo []byte) string
- func GetClockSpeed(procInfo []byte) (uint64, error)
- func GetMachineMemoryByType(edacPath string) (map[string]*info.MemoryInfo, error)
- func GetMachineMemoryCapacity() (uint64, error)
- func GetMachineSwapCapacity() (uint64, error)
- func GetPhysicalCores(procInfo []byte) int
- func GetSockets(procInfo []byte) int
- func GetTopology(sysFs sysfs.SysFs) ([]info.Node, int, error)
- func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.MachineInfo, error)
- func KernelVersion() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerOsVersion ¶
func ContainerOsVersion() string
func GetCPUVendorID ¶ added in v0.44.2
GetCPUVendorID returns "vendor_id" reading /proc/cpuinfo file.
func GetClockSpeed ¶
GetClockSpeed returns the CPU clock speed, given a []byte formatted as the /proc/cpuinfo file.
func GetMachineMemoryByType ¶ added in v0.44.2
func GetMachineMemoryByType(edacPath string) (map[string]*info.MemoryInfo, error)
GetMachineMemoryByType returns information about memory capacity and number of DIMMs. Information is retrieved from sysfs edac per-DIMM API (/sys/devices/system/edac/mc/) introduced in kernel 3.6. Documentation can be found at https://www.kernel.org/doc/Documentation/admin-guide/ras.rst. Full list of memory types can be found in edac_mc.c (https://github.com/torvalds/linux/blob/v5.5/drivers/edac/edac_mc.c#L198)
func GetMachineMemoryCapacity ¶
GetMachineMemoryCapacity returns the machine's total memory from /proc/meminfo. Returns the total memory capacity as an uint64 (number of bytes).
func GetMachineSwapCapacity ¶
GetMachineSwapCapacity returns the machine's total swap from /proc/meminfo. Returns the total swap capacity as an uint64 (number of bytes).
func GetPhysicalCores ¶ added in v0.44.2
GetPhysicalCores returns number of CPU cores reading /proc/cpuinfo file or if needed information from sysfs cpu path
func GetSockets ¶ added in v0.44.2
GetSockets returns number of CPU sockets reading /proc/cpuinfo file or if needed information from sysfs cpu path
func GetTopology ¶
GetTopology returns CPU topology reading information from sysfs
func KernelVersion ¶
func KernelVersion() string
Types ¶
This section is empty.