GetMachineSwapCapacity returns the machine's total swap from /proc/meminfo. Returns the total swap capacity as an uint64 (number of bytes).
()
| 247 | // GetMachineSwapCapacity returns the machine's total swap from /proc/meminfo. |
| 248 | // Returns the total swap capacity as an uint64 (number of bytes). |
| 249 | func 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 |
| 263 | func GetTopology(sysFs sysfs.SysFs) ([]info.Node, int, error) { |
no test coverage detected
searching dependent graphs…