View Issue Details

IDProjectCategoryView StatusLast Update
0031496RunnerWindowsPublic2021-08-04 11:34
ReporterDanAssigned ToCoreTech 
PriorityLowSeverityC - GeneralReproducibility100%
Status ResolvedResolutionNo Change Required 
Platform-OSWindows 10OS VersionPro x64
Product Version2.2.4 
Target VersionFixed in Version 
Summary0031496: Windows: Sleep margin defaulting to 10 makes a simple project's CPU usage much higher than expected on some machines
DescriptionOn 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 Reproduce1. 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...).
TagsNo tags attached.
1.4 Found In
2.x Runtime Found In2.2.4.374
2.x Runtime Verified In



2021-08-04 11:34

Adminstrator   ~0066603

Either fixed a long time ago or no longer valid in 2.3.3. Mass-closing.