aboutsummaryrefslogtreecommitdiff
path: root/weed/stats/memory.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-10-15 22:25:28 -0700
committerChris Lu <chris.lu@gmail.com>2018-10-15 22:25:28 -0700
commit46eb77f9bb629610fe90b8b9eb4d9fed2e6dda04 (patch)
treed06c90b1460710e9b16e49b6b0b6825ec0ea9d1b /weed/stats/memory.go
parenteec951cad2b276afb1a416152b049e380706ebed (diff)
downloadseaweedfs-46eb77f9bb629610fe90b8b9eb4d9fed2e6dda04.tar.xz
seaweedfs-46eb77f9bb629610fe90b8b9eb4d9fed2e6dda04.zip
move DiskStatus and MemStatus to protobuf
Diffstat (limited to 'weed/stats/memory.go')
-rw-r--r--weed/stats/memory.go19
1 files changed, 5 insertions, 14 deletions
diff --git a/weed/stats/memory.go b/weed/stats/memory.go
index 0700d92de..52bbbe7af 100644
--- a/weed/stats/memory.go
+++ b/weed/stats/memory.go
@@ -2,27 +2,18 @@ package stats
import (
"runtime"
+ "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
)
-type MemStatus struct {
- Goroutines int
- All uint64
- Used uint64
- Free uint64
- Self uint64
- Heap uint64
- Stack uint64
-}
-
-func MemStat() MemStatus {
- mem := MemStatus{}
- mem.Goroutines = runtime.NumGoroutine()
+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
- mem.fillInStatus()
+ fillInMemStatus(mem)
return mem
}