1
0
mirror of https://github.com/seaweedfs/seaweedfs.git synced 2024-12-29 20:47:54 +08:00
seaweedfs/weed/stats/memory.go

21 lines
419 B
Go
Raw Normal View History

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