1
0
mirror of https://github.com/golang/go synced 2024-11-15 04:40:28 -07:00

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 <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Russ Cox 2024-05-02 14:29:16 -04:00
parent 9d33956503
commit 20b79fd577
3 changed files with 6 additions and 1 deletions

View 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"},

View 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.

View 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
}