View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0031496||Runner||Windows||Public||2019-11-15 15:17||2021-08-04 11:34|
|Priority||Low||Severity||C - General||Reproducibility||100%|
|Status||Resolved||Resolution||No Change Required|
|Platform||-||OS||Windows 10||OS Version||Pro x64|
|Target Version||Fixed in Version|
|Summary||0031496: Windows: Sleep margin defaulting to 10 makes a simple project's CPU usage much higher than expected on some machines|
|Description||On Windows, the sleep margin method defaulting to 10 makes a simple project's CPU usage much higher than expected - especially if the tm_sleep timing method is what the game is set to use.|
Using the attached sample, my own PC uses tm_countvsyncs by default and idles pretty constantly around 0.8% CPU windowed and between 0.3-0.5% fullscreen. However, switching to tm_sleep makes this quickly rise to something highly variable between approx 9.5% to 10.5% windowed and 10% to 10.5% fullscreen. If I then adjust the sleep margin down to 1, I can see the CPU usage quickly drop to around 1-1.5% again, and a value of 0 makes the CPU usage drop to 0.0 to 0.2% (windowed and fullscreen are pretty comparable at this low sleep timing).
On the meeting room PC, using a prebuilt exe, it uses tm_countvsyncs and starts around 4.5% CPU but is very variable between 3% to 10%. Lowering the sleep margin does make a difference and drops the useage number way down. After a couple of minutes (even at 10), this PC drops to 0-05% CPU. Toggling to tm_sleep and back at 10, is still pretty variable but now generally 2-3% and occasional spikes up to 5%. It does not drop to 0% after a few mins. Lowering the sleep margin to 1 very quickly drops it consistently down under 1%.
Expected: We review whether the default sleep margin should be 1, as then if you're using tm_sleep this will result in much lower CPU usage figures, and this value doesn't seem to affect vsyncs on all machines (and when it does, it results in a lowering of reported CPU values anyway).
|Steps To Reproduce||1. Run the attached sample on your machine for Windows VM.|
2. Take note of which timing method your machine uses by default and what your various CPU usage figures are in Task Manager.
3. Try pressing and releasing your keyboard's down arrow and see if this reduces the CPU usage with lower values.
4. Set the sleep margin back to 10 and then press the spacebar to toggle to tm_sleep and see how this affects your CPU usage.
5. Again, try reducing the sleep margin.
6. Toggle fullscreen with F11 if you wish (and you have multiple monitors and Task Manager is on your second monitor...).
|Tags||No tags attached.|
|1.4 Found In|
|2.x Runtime Found In||126.96.36.1994|
|2.x Runtime Verified In|