diff options
author | Michael Anthony Knyszek <mknyszek@google.com> | 2020-08-06 16:47:58 +0000 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2020-10-26 18:29:24 +0000 |
commit | a8b28ebc87854fb6f2ba99f415f046dc2ff63604 (patch) | |
tree | a1d157399536326322763d8e9161ce656f4064e8 /src/runtime/metrics_test.go | |
parent | 07c3f65d53df7bb9f84bdbd2ab64c0ae12337e3e (diff) | |
download | go-a8b28ebc87854fb6f2ba99f415f046dc2ff63604.tar.gz go-a8b28ebc87854fb6f2ba99f415f046dc2ff63604.zip |
runtime,runtime/metrics: add heap goal and GC cycle metrics
This change adds three new metrics: the heap goal, GC cycle count, and
forced GC count. These metrics are identical to their MemStats
counterparts.
For #37112.
Change-Id: I5a5e8dd550c0d646e5dcdbdf38274895e27cdd88
Reviewed-on: https://go-review.googlesource.com/c/go/+/247044
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>
Diffstat (limited to 'src/runtime/metrics_test.go')
-rw-r--r-- | src/runtime/metrics_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/metrics_test.go b/src/runtime/metrics_test.go index 6c0be7dc0b..3724760294 100644 --- a/src/runtime/metrics_test.go +++ b/src/runtime/metrics_test.go @@ -72,6 +72,14 @@ func TestReadMetrics(t *testing.T) { checkUint64(t, name, samples[i].Value.Uint64(), mstats.Sys) case "/gc/heap/objects:objects": checkUint64(t, name, samples[i].Value.Uint64(), mstats.HeapObjects) + case "/gc/heap/goal:bytes": + checkUint64(t, name, samples[i].Value.Uint64(), mstats.NextGC) + case "/gc/cycles/automatic:gc-cycles": + checkUint64(t, name, samples[i].Value.Uint64(), uint64(mstats.NumGC-mstats.NumForcedGC)) + case "/gc/cycles/forced:gc-cycles": + checkUint64(t, name, samples[i].Value.Uint64(), uint64(mstats.NumForcedGC)) + case "/gc/cycles/total:gc-cycles": + checkUint64(t, name, samples[i].Value.Uint64(), uint64(mstats.NumGC)) } } } |