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.

20 lines
458 B

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