MCPcopy
hub / github.com/google/cadvisor / GetMachineSwapCapacity

Function GetMachineSwapCapacity

lib/machine/machine.go:249–260  ·  view source on GitHub ↗

GetMachineSwapCapacity returns the machine's total swap from /proc/meminfo. Returns the total swap capacity as an uint64 (number of bytes).

()

Source from the content-addressed store, hash-verified

247// GetMachineSwapCapacity returns the machine's total swap from /proc/meminfo.
248// Returns the total swap capacity as an uint64 (number of bytes).
249func GetMachineSwapCapacity() (uint64, error) {
250 out, err := os.ReadFile("/proc/meminfo")
251 if err != nil {
252 return 0, err
253 }
254
255 swapCapacity, err := parseCapacity(out, swapCapacityRegexp)
256 if err != nil {
257 return 0, err
258 }
259 return swapCapacity, err
260}
261
262// GetTopology returns CPU topology reading information from sysfs
263func GetTopology(sysFs sysfs.SysFs) ([]info.Node, int, error) {

Callers 2

GetSpecMethod · 0.92
InfoFunction · 0.85

Calls 2

parseCapacityFunction · 0.85
ReadFileMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…