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

@ -68,6 +68,16 @@ var allDesc = []Description{
Kind: KindUint64,
Cumulative: true,
},
{
Name: "/gc/heap/allocs-by-size:objects",
Description: "Distribution of all objects allocated by approximate size.",
Kind: KindFloat64Histogram,
},
{
Name: "/gc/heap/frees-by-size:objects",
Description: "Distribution of all objects freed by approximate size.",
Kind: KindFloat64Histogram,
},
{
Name: "/gc/heap/goal:bytes",
Description: "Heap size target for the end of the GC cycle.",