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.

21 lines
475 B

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