Skip to content

Commit 2e2ab3e

Browse files
committed
mstats: add TotalAlloc
1 parent 37e3816 commit 2e2ab3e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mstats/mstats.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ var NumGC Var
2929
// Alloc is the number of bytes allocated and not yet freed by the application
3030
var Alloc Var
3131

32+
// TotalAlloc is the total number of bytes allocated by the application
33+
var TotalAlloc Var
34+
3235
// Start polls runtime.ReadMemStats with interval d and updates the package level variables
3336
func Start(d time.Duration) {
3437
for range time.Tick(d) {
3538
var m runtime.MemStats
3639
runtime.ReadMemStats(&m)
3740
PauseNS.Store(m.PauseTotalNs)
3841
Alloc.Store(m.Alloc)
42+
TotalAlloc.Store(m.TotalAlloc)
3943
NumGC.Store(uint64(m.NumGC))
4044
}
4145
}

0 commit comments

Comments
 (0)