memtotal_linux.go 259 B

1234567891011121314
  1. package sysinfo
  2. import "os"
  3. // PhysicalMemoryBytes returns the total amount of host memory.
  4. func PhysicalMemoryBytes() (uint64, error) {
  5. f, err := os.Open("/proc/meminfo")
  6. if err != nil {
  7. return 0, err
  8. }
  9. defer f.Close()
  10. return parseProcMeminfo(f)
  11. }