Skip to content

Commit

Permalink
runtime/metrics: add /gc/scan/total:bytes
Browse files Browse the repository at this point in the history
For #56857

Change-Id: I10dbc5db506c95b7578c2b6baf051a351f68bb2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/497576
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
  • Loading branch information
felixge authored and gopherbot committed May 23, 2023
1 parent 131267f commit 5124371
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/runtime/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ func initMetrics() {
out.scalar = gcController.heapScan.Load()
},
},
"/gc/scan/total:bytes": {
compute: func(in *statAggregate, out *metricValue) {
out.kind = metricKindUint64
out.scalar = gcController.globalsScan.Load() + gcController.heapScan.Load() + gcController.lastStackScan.Load()
},
},
"/gc/heap/allocs-by-size:bytes": {
deps: makeStatDepSet(heapStatsDep),
compute: func(in *statAggregate, out *metricValue) {
Expand Down
5 changes: 5 additions & 0 deletions src/runtime/metrics/description.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ var allDesc = []Description{
Description: "The number of bytes of stack that were scanned last GC cycle.",
Kind: KindUint64,
},
{
Name: "/gc/scan/total:bytes",
Description: "The total amount space that is scannable. Sum of all metrics in /gc/scan.",
Kind: KindUint64,
},
{
Name: "/gc/stack/starting-size:bytes",
Description: "The stack size of new goroutines.",
Expand Down
4 changes: 4 additions & 0 deletions src/runtime/metrics/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ Below is the full list of supported metrics, ordered lexicographically.
/gc/scan/stack:bytes
The number of bytes of stack that were scanned last GC cycle.
/gc/scan/total:bytes
The total amount space that is scannable. Sum of all metrics in
/gc/scan.
/gc/stack/starting-size:bytes
The stack size of new goroutines.
Expand Down

0 comments on commit 5124371

Please sign in to comment.