2021-09-01 17:45:42 +08:00
|
|
|
//go:build linux
|
2014-03-29 03:18:01 +08:00
|
|
|
// +build linux
|
|
|
|
|
|
|
|
package stats
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
2018-10-16 13:25:28 +08:00
|
|
|
|
2022-07-29 15:17:28 +08:00
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
|
2014-03-29 03:18:01 +08:00
|
|
|
)
|
|
|
|
|
2018-10-16 13:25:28 +08:00
|
|
|
func fillInMemStatus(mem *volume_server_pb.MemStatus) {
|
2014-03-29 03:18:01 +08:00
|
|
|
//system memory usage
|
|
|
|
sysInfo := new(syscall.Sysinfo_t)
|
|
|
|
err := syscall.Sysinfo(sysInfo)
|
|
|
|
if err == nil {
|
|
|
|
mem.All = uint64(sysInfo.Totalram) //* uint64(syscall.Getpagesize())
|
|
|
|
mem.Free = uint64(sysInfo.Freeram) //* uint64(syscall.Getpagesize())
|
|
|
|
mem.Used = mem.All - mem.Free
|
|
|
|
}
|
|
|
|
}
|