]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/metrics: add /gc/scan/total:bytes
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Tue, 23 May 2023 10:35:48 +0000 (12:35 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 23 May 2023 19:21:39 +0000 (19:21 +0000)
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>

src/runtime/metrics.go
src/runtime/metrics/description.go
src/runtime/metrics/doc.go

index 356d21ae7d4d0a38a5669cf1de05d603e30670ce..4c51efaad9f1b0379c9421fe00a376723a73bcc7 100644 (file)
@@ -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) {
index ac6f43707593abea89ffa1d0b2db1151cc1f9d9b..b34ffe405dfb321a6bf580aa696b362da523b34a 100644 (file)
@@ -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.",
index 15fba2b5d443e472dba783849ce28faa9066be2b..44e2676ac5d8cff4ef96e2b6f123fce8af6ccb18 100644 (file)
@@ -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.