var coreRegExp … var nodeRegExp … var cpuClockSpeedMHz … var memoryCapacityRegexp … var swapCapacityRegexp … var vendorIDRegexp … var cpuAttributesPath … var isMemoryController … var isDimm … var machineArch … var maxFreqFile … const memTypeFileName … const sizeFileName … // GetCPUVendorID returns "vendor_id" reading /proc/cpuinfo file. func GetCPUVendorID(procInfo []byte) string { … } // GetPhysicalCores returns number of CPU cores reading /proc/cpuinfo file or if needed information from sysfs cpu path func GetPhysicalCores(procInfo []byte) int { … } // GetSockets returns number of CPU sockets reading /proc/cpuinfo file or if needed information from sysfs cpu path func GetSockets(procInfo []byte) int { … } // GetClockSpeed returns the CPU clock speed, given a []byte formatted as the /proc/cpuinfo file. func GetClockSpeed(procInfo []byte) (uint64, error) { … } // GetMachineMemoryCapacity returns the machine's total memory from /proc/meminfo. // Returns the total memory capacity as an uint64 (number of bytes). func GetMachineMemoryCapacity() (uint64, 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 GetMachineMemoryByType(edacPath string) (map[string]*info.MemoryInfo, error) { … } func mbToBytes(megabytes int) int { … } // GetMachineSwapCapacity returns the machine's total swap from /proc/meminfo. // Returns the total swap capacity as an uint64 (number of bytes). func GetMachineSwapCapacity() (uint64, error) { … } // GetTopology returns CPU topology reading information from sysfs func GetTopology(sysFs sysfs.SysFs) ([]info.Node, int, error) { … } // parseCapacity matches a Regexp in a []byte, returning the resulting value in bytes. // Assumes that the value matched by the Regexp is in KB. func parseCapacity(b []byte, r *regexp.Regexp) (uint64, error) { … } // getUniqueMatchesCount returns number of unique matches in given argument using provided regular expression func getUniqueMatchesCount(s string, r *regexp.Regexp) int { … } func getMachineArch() string { … } // arm32 changes func isArm32() bool { … } // aarch64 changes func isAArch64() bool { … } // s390/s390x changes func isSystemZ() bool { … } // riscv64 changes func isRiscv64() bool { … } // mips64 changes func isMips64() bool { … }