You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
419 B

6 years ago
  1. package stats
  2. import (
  3. "runtime"
  4. "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
  5. )
  6. func MemStat() *volume_server_pb.MemStatus {
  7. mem := &volume_server_pb.MemStatus{}
  8. mem.Goroutines = int32(runtime.NumGoroutine())
  9. memStat := new(runtime.MemStats)
  10. runtime.ReadMemStats(memStat)
  11. mem.Self = memStat.Alloc
  12. mem.Heap = memStat.HeapAlloc
  13. mem.Stack = memStat.StackInuse
  14. fillInMemStatus(mem)
  15. return mem
  16. }