seaweedfs/weed/stats/memory.go

21 lines
419 B
Go
Raw Permalink Normal View History

2014-03-26 20:22:27 +00:00
package stats
import (
"runtime"
2018-10-24 06:59:49 +00:00
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
2014-03-26 20:22:27 +00:00
)
func MemStat() *volume_server_pb.MemStatus {
mem := &volume_server_pb.MemStatus{}
mem.Goroutines = int32(runtime.NumGoroutine())
2014-03-26 20:22:27 +00:00
memStat := new(runtime.MemStats)
runtime.ReadMemStats(memStat)
mem.Self = memStat.Alloc
mem.Heap = memStat.HeapAlloc
mem.Stack = memStat.StackInuse
fillInMemStatus(mem)
2014-03-26 20:22:27 +00:00
return mem
}