package runtime_test
import (
+ "internal/testenv"
"reflect"
"runtime"
"runtime/debug"
// test is basically meaningless on this platform.
t.Skip("wasip1 currently busy-waits in idle time; test not applicable")
}
+
+ // Unconditionally skip this test as flaky.
+ //
+ // There's a fundamental issue with this test, which is that there's no
+ // guarantee the application will go idle; background goroutines and
+ // time spent in the scheduler going to sleep can always erode idle time
+ // sufficiently such that minimum idle time (or maximum user time) stays
+ // within some threshold.
+ //
+ // Leave this as skipped while we figure out a better way to check this.
+ testenv.SkipFlaky(t, 60376)
+
names := []string{
"/cpu/classes/idle:cpu-seconds",
metrics.Read(m2)
// If the bug we expect is happening, then the Sleep CPU time will be accounted for
- // as user time rather than idle time. Because we're doing this on one core, the
- // maximum amount of time that can be attributed to user time is the time spent asleep.
+ // as user time rather than idle time.
+ //
+ // TODO(mknyszek): This number here is wrong. Background goroutines and just slow
+ // platforms spending a non-trivial amount of time in the scheduler doing things
+ // could easily erode idle time beyond this minimum.
minIdleCPUSeconds := dur.Seconds() * float64(runtime.GOMAXPROCS(-1))
if dt := m2[0].Value.Float64() - m1[0].Value.Float64(); dt < minIdleCPUSeconds {