mirror of
https://github.com/golang/go
synced 2024-11-19 17:34:41 -07:00
11eaf42886
Currently Go sets the system-wide timer resolution to 1ms the whole time it's running. This has negative affects on system performance and power consumption. Unfortunately, simply reducing the timer resolution to the default 15ms interferes with several sleeps in the runtime itself, including sysmon's ability to interrupt goroutines. This commit takes a hybrid approach: it only reduces the timer resolution when the Go process is entirely idle. When the process is idle, nothing needs a high resolution timer. When the process is non-idle, it's already consuming CPU so it doesn't really matter if the OS also takes timer interrupts more frequently. Updates #8687. Change-Id: I0652564b4a36d61a80e045040094a39c19da3b06 Reviewed-on: https://go-review.googlesource.com/38403 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
12 lines
316 B
Go
12 lines
316 B
Go
// Copyright 2017 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build !windows
|
|
|
|
package runtime
|
|
|
|
// osRelax is called by the scheduler when transitioning to and from
|
|
// all Ps being idle.
|
|
func osRelax(relax bool) {}
|