2015-05-13 03:35:16 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Stats() map[string]uint64 {
|
|
|
|
var stats runtime.MemStats
|
|
|
|
runtime.ReadMemStats(&stats)
|
|
|
|
|
|
|
|
return map[string]uint64{
|
|
|
|
"timestamp": uint64(time.Now().Unix()),
|
|
|
|
"HeapInuse": stats.HeapInuse,
|
|
|
|
"StackInuse": stats.StackInuse,
|
|
|
|
"NuGoroutines": uint64(runtime.NumGoroutine()),
|
2015-05-13 17:44:44 +03:00
|
|
|
"Mallocs": stats.Mallocs,
|
|
|
|
"Frees": stats.Mallocs,
|
|
|
|
"Inbound": uint64(messages.Get("inbound")),
|
|
|
|
"Outbound": uint64(messages.Get("outbound")),
|
2015-05-13 03:35:16 +03:00
|
|
|
}
|
|
|
|
}
|