Log in

View Full Version : How to suppress energy saving with CLI?


LigH
20th March 2015, 18:01
Trying to use some PCs I have access to "over night" to benchmark x265 encodings with different CPUs, I found that it usually fails to run encodes in a batch because Windows 7 may enter an energy saving state while x265 is busy.

To avoid manipulating power plans on other PCs, I'd like to execute a CLI tool which will suppress energy saving while the batch is executed, and restores the previous state when the batch is done. Do you know any such tool?

There seems to be a "portable" GUI tool called "Don't Sleep", but I would prefer CLI.

pie
21st March 2015, 10:03
I'm sure there's an existing solution already, but it wasn't hard to code, so try this (source included): http://www.mediafire.com/download/ftoxjckuhad0nh7/unsleep-r1.zip

You just prepend 'unsleep' to the command. It uses SetThreadExecutionState to prevent sleep. I haven't really tested it, so I think it works, but I can't say for sure... It also doesn't forward piped data.

LigH
21st March 2015, 14:58
Thank you, I will test this tool, probaby let it execute a whole batch file... Not during the weekend, though.

LoRd_MuldeR
21st March 2015, 23:59
FWIW, Simple x264/x265 Launcher will also call SetThreadExecutionState() in order to prevent the system from entering "energy saving" mode while encoding.

LigH
27th March 2015, 19:53
@ pie:

Thank you, your tool works exactly as expected.

LigH
30th March 2015, 13:14
Today a patch was suggested to let x265 for Windows set its thread execution state on its own.

Nevertheless, this tool may be useful for other purposes as well.