2014-03-26 20:22:27 +00:00
|
|
|
package stats
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
2018-10-24 06:59:49 +00:00
|
|
|
|
2022-07-29 07:17:28 +00:00
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
|
2014-03-26 20:22:27 +00:00
|
|
|
)
|
|
|
|
|
2018-10-16 05:25:28 +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
|
|
|
|
|
2018-10-16 05:25:28 +00:00
|
|
|
fillInMemStatus(mem)
|
2014-03-26 20:22:27 +00:00
|
|
|
return mem
|
|
|
|
}
|