From: Russ Cox Date: Thu, 2 May 2024 18:29:16 +0000 (-0400) Subject: time: provide non-default metric for asynctimerchan X-Git-Tag: go1.23rc2~2^2~68 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=20b79fd577;p=gostls13.git time: provide non-default metric for asynctimerchan The original implementation could not support a non-default metric, but now that it is set during package time, we can. Do that. Change-Id: If7929b0afa5b0142d299718d9bd811c5a8d1cf93 Reviewed-on: https://go-review.googlesource.com/c/go/+/589058 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- diff --git a/src/internal/godebugs/table.go b/src/internal/godebugs/table.go index 4c084635fb..a802ac9c37 100644 --- a/src/internal/godebugs/table.go +++ b/src/internal/godebugs/table.go @@ -25,7 +25,7 @@ type Info struct { // Note: After adding entries to this table, update the list in doc/godebug.md as well. // (Otherwise the test in this package will fail.) var All = []Info{ - {Name: "asynctimerchan", Package: "time", Changed: 23, Old: "1", Opaque: true}, + {Name: "asynctimerchan", Package: "time", Changed: 23, Old: "1"}, {Name: "execerrdot", Package: "os/exec"}, {Name: "gocachehash", Package: "cmd/go"}, {Name: "gocachetest", Package: "cmd/go"}, diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go index b8be9f8272..da3d956d48 100644 --- a/src/runtime/metrics/doc.go +++ b/src/runtime/metrics/doc.go @@ -230,6 +230,10 @@ Below is the full list of supported metrics, ordered lexicographically. /gc/stack/starting-size:bytes The stack size of new goroutines. + /godebug/non-default-behavior/asynctimerchan:events + The number of non-default behaviors executed by the time package + due to a non-default GODEBUG=asynctimerchan=... setting. + /godebug/non-default-behavior/execerrdot:events The number of non-default behaviors executed by the os/exec package due to a non-default GODEBUG=execerrdot=... setting. diff --git a/src/time/sleep.go b/src/time/sleep.go index 2c6495d93a..7e2fa0c20a 100644 --- a/src/time/sleep.go +++ b/src/time/sleep.go @@ -23,6 +23,7 @@ func syncTimer(c chan Time) unsafe.Pointer { // If asynctimerchan=1, we don't even tell the runtime // about channel timers, so that we get the pre-Go 1.23 code paths. if asynctimerchan.Value() == "1" { + asynctimerchan.IncNonDefault() return nil }