VictoriaMetrics/lib/memory/memory_bsd.go

18 lines
377 B
Go
Raw Permalink Normal View History

//go:build freebsd || openbsd || dragonfly || netbsd
2019-08-27 22:04:44 +00:00
package memory
import (
"github.com/VictoriaMetrics/VictoriaMetrics/lib/logger"
)
// This code has been adopted from https://github.com/pbnjay/memory
func sysTotalMemory() int {
s, err := sysctlUint64("hw.physmem")
if err != nil {
logger.Panicf("FATAL: cannot determine system memory: %s", err)
}
return int(s)
}