mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
07c3f65d53
commit
a8b28ebc87
4 changed files with 86 additions and 8 deletions
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue