mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-25 03:29:10 +08:00
21 lines
419 B
Go
21 lines
419 B
Go
package stats
|
|
|
|
import (
|
|
"runtime"
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
|
)
|
|
|
|
func MemStat() *volume_server_pb.MemStatus {
|
|
mem := &volume_server_pb.MemStatus{}
|
|
mem.Goroutines = int32(runtime.NumGoroutine())
|
|
memStat := new(runtime.MemStats)
|
|
runtime.ReadMemStats(memStat)
|
|
mem.Self = memStat.Alloc
|
|
mem.Heap = memStat.HeapAlloc
|
|
mem.Stack = memStat.StackInuse
|
|
|
|
fillInMemStatus(mem)
|
|
return mem
|
|
}
|