-
Notifications
You must be signed in to change notification settings - Fork 1
/
helper.go
44 lines (41 loc) · 1.16 KB
/
helper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package stati
import (
"runtime"
"time"
)
func getStats() *statsResp {
var stats runtime.MemStats
runtime.ReadMemStats(&stats)
return &statsResp{
HeapAlloc: stats.HeapAlloc,
HeapSys: stats.HeapSys,
HeapIdle: stats.HeapIdle,
HeapInuse: stats.HeapInuse,
HeapReleased: stats.HeapReleased,
HeapObjects: stats.HeapObjects,
Mallocs: stats.Mallocs,
Frees: stats.Frees,
NextGC: stats.NextGC,
LastGC: time.Unix(0, int64(stats.LastGC)),
GCSys: stats.GCSys,
Alloc: stats.Alloc,
NumGC: stats.NumGC,
NumForcedGC: stats.NumForcedGC,
GCCPUFraction: stats.GCCPUFraction,
PauseTotalNs: stats.PauseTotalNs,
EnableGC: stats.EnableGC,
DebugGC: stats.DebugGC,
TotalAlloc: stats.TotalAlloc,
Sys: stats.Sys,
OtherSys: stats.OtherSys,
Lookups: stats.Lookups,
StackInuse: stats.StackInuse,
StackSys: stats.StackSys,
MSpanInuse: stats.MSpanInuse,
MSpanSys: stats.MSpanSys,
MCacheInuse: stats.MCacheInuse,
MCacheSys: stats.MCacheSys,
BuckHashSys: stats.BuckHashSys,
NumGoroutines: runtime.NumGoroutine(),
}
}