mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
393 stars 115 forks source link

CPU Usage When Idle #400

Open Enverex opened 6 years ago

Enverex commented 6 years ago

CPU usage when playing videos or switching content during the screen-saver is understandable, but it appears that AM is still "active" even after hitting the "screen_saver_timeout". The screen goes black and you'd assume that everything has "stopped" but I'm still seeing 4-6% CPU usage on an i7 machine.

Is it possible to make AM actually properly sleep and stop using CPU time when it should be in this standby type mode?

oomek commented 6 years ago

Why won’t you trigger the proper sleep mode instead of just blanking the screen?

oomek commented 6 years ago

Add this as a command in screensaver settings

rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Enverex commented 6 years ago

Why won’t you trigger the proper sleep mode instead of just blanking the screen?

Are you talking to me or mickelson? If me, then it's because I still need the machine accessible over the network.

Add this as a command in screensaver settings

Not relevant on Linux, and again, that puts the entire machine in suspend which isn't what we're discussing here.

This bug is about AttractMode still using a decent amount of CPU time despite being idle (with no content playing).

oomek commented 6 years ago

Ok, fair enough. Didn’t know you are on linux.

Enverex commented 6 years ago

I'm now seeing usage between 0 and 2%. Much better but not perfect (not sure what's causing the 2% spike roughly 50% of the time). Is it simply because it's sat in that 15ms delay game loop at that point?

Enverex commented 6 years ago

Found an interesting bug tied to this. If my screen is off and AttractMode goes to "sleep", it eats 100% CPU (100% of a single core) whilst not doing anything. Waking it back up causes it to go back to ~25% CPU when showing a video in the games list.