github.com/lulzWill/go-agent@v2.1.2+incompatible/internal/sysinfo/memtotal_linux.go (about)

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