runtime,runtime/metrics: add object size distribution metrics

This change adds metrics for the distribution of objects allocated and
freed by size, mirroring MemStats' BySize field.

For #37112.

Change-Id: Ibaf1812da93598b37265ec97abc6669c1a5efcbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/247045
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Anthony Knyszek 2020-08-06 19:04:46 +00:00 committed by Michael Knyszek
parent c305e49e96
commit 8e2370bf7f
4 changed files with 104 additions and 0 deletions

View file

@ -53,6 +53,12 @@ Supported metrics
/gc/cycles/total:gc-cycles
Count of all completed GC cycles.
/gc/heap/allocs-by-size:objects
Distribution of all objects allocated by approximate size.
/gc/heap/frees-by-size:objects
Distribution of all objects freed by approximate size.
/gc/heap/goal:bytes
Heap size target for the end of the GC cycle.