]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: fix usage of stale "now" value for netpolling Ms
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 18 May 2023 15:51:57 +0000 (15:51 +0000)
committerMichael Knyszek <mknyszek@google.com>
Tue, 23 May 2023 19:24:33 +0000 (19:24 +0000)
commit6f13d0bfe42115d1d5452bee0bb7648d968beeb4
treedd50d8bea8397895dddbb29614a62b907773afe4
parent5124371c1c7d6e2f5c8ebf821fdd07ea71d564c7
runtime: fix usage of stale "now" value for netpolling Ms

Currently pidleget gets passed "now" from before the M goes into
netpoll, resulting in incorrect accounting of idle CPU time.
lastpoll is also stored with a stale "now": the mistake was added in the
same CL it was added for pidleget.

Recompute "now" after returning from netpoll.

Also, start tracking idle time on js/wasm at all.

Credit to Rhys Hiltner for the test case.

Fixes #60276.

Change-Id: I5dd677471f74c915dfcf3d01621430876c3ff307
Reviewed-on: https://go-review.googlesource.com/c/go/+/496183
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/runtime/lock_js.go
src/runtime/metrics_test.go
src/runtime/proc.go