]> Cypherpunks repositories - gostls13.git/commitdiff
time: provide non-default metric for asynctimerchan
authorRuss Cox <rsc@golang.org>
Thu, 2 May 2024 18:29:16 +0000 (14:29 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 21 Jun 2024 12:36:22 +0000 (12:36 +0000)
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 <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/internal/godebugs/table.go
src/runtime/metrics/doc.go
src/time/sleep.go

index 4c084635fbe1b0c4f0f68504ef2b5edd8a420b1c..a802ac9c3708d10065346c6e0ee80f8f312f12ab 100644 (file)
@@ -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"},
index b8be9f8272ba76e9e2bbbc0b37d3e83c40b51312..da3d956d480bebbc037154003be638becc8b0411 100644 (file)
@@ -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.
index 2c6495d93a704d75357519afadb49066aa73d0ed..7e2fa0c20af46e2132aa9f4ea017987fd6eca212 100644 (file)
@@ -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
        }