Skip to content

Commit

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

Change-Id: I748fd2a33ee76d9a83ea42f2ebf6d9edda243301
Reviewed-on: https://go-review.googlesource.com/c/go/+/497320
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
felixge authored and gopherbot committed May 23, 2023
1 parent 8b51eb5 commit a63afe4
Show file tree
Hide file tree
Showing 3 changed files with 14 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 @@ -189,6 +189,12 @@ func initMetrics() {
out.scalar = in.sysStats.gcCyclesDone
},
},
"/gc/scan/globals:bytes": {
compute: func(in *statAggregate, out *metricValue) {
out.kind = metricKindUint64
out.scalar = gcController.globalsScan.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 @@ -294,6 +294,11 @@ var allDesc = []Description{
Kind: KindFloat64Histogram,
Cumulative: true,
},
{
Name: "/gc/scan/globals:bytes",
Description: "The total amount of global variable space that is scannable.",
Kind: KindUint64,
},
{
Name: "/gc/scan/stack:bytes",
Description: "The number of bytes of stack that were scanned last GC cycle.",
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/metrics/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ Below is the full list of supported metrics, ordered lexicographically.
Distribution of individual GC-related stop-the-world pause
latencies. Bucket counts increase monotonically.
/gc/scan/globals:bytes
The total amount of global variable space that is scannable.
/gc/scan/stack:bytes
The number of bytes of stack that were scanned last GC cycle.
Expand Down

0 comments on commit a63afe4

Please sign in to comment.