go/src/runtime/metrics
Michael Anthony Knyszek 897baae953 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>
2021-04-29 21:54:05 +00:00
..
description.go runtime/metrics: add additional allocation metrics 2021-04-29 21:54:05 +00:00
description_test.go runtime/metrics: add ordering line to supported metrics docs 2020-12-10 21:08:10 +00:00
doc.go runtime/metrics: add additional allocation metrics 2021-04-29 21:54:05 +00:00
example_test.go runtime/metrics: fix panic in readingAllMetric example 2021-02-08 16:09:01 +00:00
histogram.go runtime,runtime/metrics: use explicit histogram boundaries 2021-01-08 03:43:44 +00:00
sample.go runtime/metrics: update documentation to current interface 2021-02-16 16:26:30 +00:00
value.go runtime/metrics: fix a couple of documentation typpos 2021-02-09 02:00:01 +00:00