You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
381 B

  1. // +build linux
  2. package stats
  3. import (
  4. "syscall"
  5. )
  6. func (mem *MemStatus) fillInStatus() {
  7. //system memory usage
  8. sysInfo := new(syscall.Sysinfo_t)
  9. err := syscall.Sysinfo(sysInfo)
  10. if err == nil {
  11. mem.All = uint64(sysInfo.Totalram) //* uint64(syscall.Getpagesize())
  12. mem.Free = uint64(sysInfo.Freeram) //* uint64(syscall.Getpagesize())
  13. mem.Used = mem.All - mem.Free
  14. }
  15. }