]> Cypherpunks repositories - gostls13.git/commit
runtime/metrics: add additional allocation metrics
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 20 Apr 2021 19:30:21 +0000 (19:30 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 29 Apr 2021 21:54:05 +0000 (21:54 +0000)
commit897baae953ca812005703d367234b3b867f2a4b0
tree7ce11f007a16186fffadaa164b8051fb1a5efde0
parentfd095936673dcb53b96b825d95c1e83adde3ce15
runtime/metrics: add additional allocation metrics

This change adds four additional metrics to the runtime/metrics package
to fill in a few gaps with runtime.MemStats that were overlooked. The
biggest one is TotalAlloc, which is impossible to find with the
runtime/metrics package, but also add a few others for convenience and
clarity. For instance, the total number of objects allocated and freed
are technically available via allocs-by-size and frees-by-size, but it's
onerous to get them (one needs to sum the sample counts in the
histograms).

The four additional metrics are:
- /gc/heap/allocs:bytes   -- total bytes allocated (TotalAlloc)
- /gc/heap/allocs:objects -- total objects allocated (Mallocs - [tiny])
- /gc/heap/frees:bytes    -- total bytes frees (TotalAlloc-HeapAlloc)
- /gc/heap/frees:objects  -- total objects freed (Frees - [tiny])

This change also updates the descriptions of allocs-by-size and
frees-by-size to be more precise.

Change-Id: Iec8c1797a584491e3484b198f2e7f325b68954a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/312431
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/runtime/metrics.go
src/runtime/metrics/description.go
src/runtime/metrics/doc.go
src/runtime/metrics_test.go