]> Cypherpunks repositories - gostls13.git/commit
runtime: use next timer to decide whether to relax
authorAustin Clements <austin@google.com>
Fri, 7 Jul 2017 18:58:55 +0000 (14:58 -0400)
committerAustin Clements <austin@google.com>
Fri, 7 Jul 2017 21:22:31 +0000 (21:22 +0000)
commit093adeef4004fd029de1a8fd138802607265dc73
tree8bff9c0748af62f7ced4477bc075cfa2d25ea8c2
parent7a8f39fa14d519f6efc34b2a783098bd107d17e0
runtime: use next timer to decide whether to relax

Currently, sysmon waits 60 ms during idle before relaxing. This is
primarily to avoid reducing the precision of short-duration timers. Of
course, if there are no short-duration timers, this wastes 60 ms
running the timer at high resolution.

Improve this by instead inspecting the time until the next timer fires
and relaxing the timer resolution immediately if the next timer won't
fire for a while.

Updates #20937.

Change-Id: If4ad0a565b65a9b3e8c4cdc2eff1486968c79f24
Reviewed-on: https://go-review.googlesource.com/47833
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/os_windows.go
src/runtime/proc.go
src/runtime/relax_stub.go
src/runtime/time.go