Implement CPU throttling with sleep and hi-res timers instead of busy waiting |
||||
Issue descriptionThe change in crrev.com/1977693002 to add CPU throttling to Windows also means that a devtools thread will be 100% busy, due to the limitations of timers on Windows. As the comment says, by default Sleep() on Windows has 16 ms granularity. However, the global timer interrupt frequency can be changed easily to 1 kHz, giving 1 ms granularity. This would allow CPU throttling to not be such a CPU/battery hog. timeBeginPeriod is the function to do this: https://msdn.microsoft.com/en-us/library/windows/desktop/dd757624(v=vs.85).aspx It is even possible to raise the timer frequency on most machines to 2 kHz, although this is less useful since Sleep() still only has ms granularity in its parameters. If the timer frequency is raised then it should be restored when the CPU throttling is finished because (perversely enough) having the timer frequency raised also increases CPU power usage slightly, just nowhere near as much as a busy loop. Something to consider...
,
Sep 1 2016
Indeed implementing a better approach is on my list. I'll use this CR for it. Thank you.
,
Dec 14 2016
,
May 8 2017
,
Oct 31
Bulk closing low-priority issues with no activity. Please re-file and refer to the closed issue if it's essential to fix. |
||||
►
Sign in to add a comment |
||||
Comment 1 by brucedaw...@chromium.org
, Sep 1 2016