aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2025-07-23 18:41:56 +0000
committerGopher Robot <gobot@golang.org>2025-08-15 11:31:04 -0700
commitab8121a407280bf39bdd401699476feb39ccd0f7 (patch)
treef7ae1dbfe10d24343219f76104d9631197834bab /src/runtime/runtime2.go
parent13df972f6885ebdeba1ea38f0acd99ea0f2bfb49 (diff)
downloadgo-ab8121a407280bf39bdd401699476feb39ccd0f7.tar.xz
runtime/metrics: add metric for total goroutines created
For #15490. Change-Id: Ic587dda1f42d613ea131a6b53ce6ba6e6cadf4c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/690398 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index c5d15754ec..a80a34a18e 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -764,6 +764,9 @@ type p struct {
// gcStopTime is the nanotime timestamp that this P last entered _Pgcstop.
gcStopTime int64
+ // goroutinesCreated is the total count of goroutines created by this P.
+ goroutinesCreated uint64
+
// xRegs is the per-P extended register state used by asynchronous
// preemption. This is an empty struct on platforms that don't use extended
// register state.
@@ -892,6 +895,10 @@ type schedt struct {
// M, but waiting for locks within the runtime. This field stores the value
// for Ms that have exited.
totalRuntimeLockWaitTime atomic.Int64
+
+ // goroutinesCreated (plus the value of goroutinesCreated on each P in allp)
+ // is the sum of all goroutines created by the program.
+ goroutinesCreated atomic.Uint64
}
// Values for the flags field of a sigTabT.