mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
fd09593667
commit
897baae953
4 changed files with 164 additions and 18 deletions
|
|
@ -70,17 +70,50 @@ var allDesc = []Description{
|
|||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/heap/allocs-by-size:bytes",
|
||||
Description: "Distribution of all objects allocated by approximate size.",
|
||||
Kind: KindFloat64Histogram,
|
||||
Name: "/gc/heap/allocs-by-size:bytes",
|
||||
Description: "Distribution of heap allocations by approximate size. " +
|
||||
"Note that this does not include tiny objects as defined by " +
|
||||
"/gc/heap/tiny/allocs:objects, only tiny blocks.",
|
||||
Kind: KindFloat64Histogram,
|
||||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/heap/allocs:bytes",
|
||||
Description: "Cumulative sum of memory allocated to the heap by the application.",
|
||||
Kind: KindUint64,
|
||||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/heap/frees-by-size:bytes",
|
||||
Description: "Distribution of all objects freed by approximate size.",
|
||||
Kind: KindFloat64Histogram,
|
||||
Name: "/gc/heap/allocs:objects",
|
||||
Description: "Cumulative count of heap allocations triggered by the application. " +
|
||||
"Note that this does not include tiny objects as defined by " +
|
||||
"/gc/heap/tiny/allocs:objects, only tiny blocks.",
|
||||
Kind: KindUint64,
|
||||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/heap/frees-by-size:bytes",
|
||||
Description: "Distribution of freed heap allocations by approximate size. " +
|
||||
"Note that this does not include tiny objects as defined by " +
|
||||
"/gc/heap/tiny/allocs:objects, only tiny blocks.",
|
||||
Kind: KindFloat64Histogram,
|
||||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/heap/frees:bytes",
|
||||
Description: "Cumulative sum of heap memory freed by the garbage collector.",
|
||||
Kind: KindUint64,
|
||||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/heap/frees:objects",
|
||||
Description: "Cumulative count of heap allocations whose storage was freed " +
|
||||
"by the garbage collector. " +
|
||||
"Note that this does not include tiny objects as defined by " +
|
||||
"/gc/heap/tiny/allocs:objects, only tiny blocks.",
|
||||
Kind: KindUint64,
|
||||
Cumulative: true,
|
||||
},
|
||||
{
|
||||
Name: "/gc/heap/goal:bytes",
|
||||
Description: "Heap size target for the end of the GC cycle.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue