Page 1 of 1

[0.15.26] High CPU usage when paused.

Posted: Mon Jul 03, 2017 5:45 am
by lxx
I am playing Factorio on a notebook. Sometimes I can only play some minutes at a time, so I usually leave it running, but paused. Since Factorio's CPU usage doesn't seem to reduce when paused, this keeps the fan spinning all the time, and the notebook gets quite warm. Would be nice if Factorio could reduce its CPU usage while paused.

Running with vsync disabled on Linux, X with Intel/modesetting driver.

This issue is not new in 0.15.18, it happened in all the versions before (that I played). So at least 0.14 and 0.13 as well.

Edit: CPU usage does go down when paused, but is still somewhat high. vsync doesn't seem to make a difference.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 6:55 am
by Loewchen
Update to 15.26 and post the log please.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 9:53 am
by mrvn
If you are playing under Linux I suggest starting factorio from a terminal and pressing ctrl-z to really pause the game and then "fg" to unpause it.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 9:57 am
by sillyfly
mrvn wrote:If you are playing under Linux I suggest starting factorio from a terminal and pressing ctrl-z to really pause the game and then "fg" to unpause it.


This will work, but is more of a "patch", and it may have undesired side-effects (Factorio has issues in Windows when locking / switching users / resuming from sleep - I'm guessing similar things may happen when backgrounding under Linux).

Assuming most of the processing power is in the actual game simulation you would expect the CPU usage to drop significantly when the game is paused. If it doesn't - maybe there's a problem somewhere? (Or perhaps the architecture of the game/engine makes it much simpler to "run the simulation on idle" when paused... I can see this being the case).

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 10:00 am
by Rseding91
The game simulation is paused when the game is paused so any CPU usage you're seeing is rendering and processing of input. I can't speak for the linux build but on Windows when I pause the game the CPU usage drops to almost nothing.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 10:11 am
by mrvn
By the way, what do you mean by "pause the game"? Just opening the game menu?

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 11:25 am
by lxx
Loewchen wrote:Update to 15.26 and post the log please.
There you go.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 11:26 am
by lxx
mrvn wrote:If you are playing under Linux I suggest starting factorio from a terminal and pressing ctrl-z to really pause the game and then "fg" to unpause it.
Well, I'm sending kill -STOP/-CONT, but the result should be the same. But it's a bit tedious.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 11:27 am
by lxx
mrvn wrote:By the way, what do you mean by "pause the game"? Just opening the game menu?
Shift+Space, for me the that's binding for "Pause game" in the Options/Controls/Game. But it's about the same in the menu, I think.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 11:34 am
by lxx
Rseding91 wrote:The game simulation is paused when the game is paused so any CPU usage you're seeing is rendering and processing of input. I can't speak for the linux build but on Windows when I pause the game the CPU usage drops to almost nothing.
Well, my notebook (Haswell with on-chip GPU), is not very fast. The game runs acceptably, but when it's paused and in the background, it still eats ~50% of one CPU, which results in a lot of heat and fan noise.

That being sad, pausing the game results in a lower CPU usage. When playing it's easily >100%.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 12:15 pm
by mrvn
Yeah, it's still drawing 60 fps. On my old low end desktop the FPS actually goes way up when I pause the game. All the time saved by not doing ticks goes into frame redraws. Playing I didn't get 60 fps, paused I do.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 1:35 pm
by rorror
I noticed this too. I think this was not happend in v0.14

When fully Zoomed In, and game is paused, it uses 4% cpu.
paused zoomed in.PNG
paused zoomed in.PNG (751.17 KiB) Viewed 5424 times
When fully zoomed Out, the game uses in paused mode about 19%..
paused_mode.PNG
paused_mode.PNG (1.19 MiB) Viewed 5424 times

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 1:47 pm
by Oxyd
The game still renders when it's paused, so that takes some amount of CPU. If your hardware is not very fast, this might cause considerable CPU load.

Make sure you don't have any of the debug options enabled – they can take a lot of CPU to process.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 2:02 pm
by rorror
Oxyd wrote:The game still renders when it's paused, so that takes some amount of CPU. If your hardware is not very fast, this might cause considerable CPU load.

Make sure you don't have any of the debug options enabled – they can take a lot of CPU to process.
With the debug off (it did for me only show ups fps, does for me not change cpu %)

When i play the game on full zoom window it uses 25%cpu (60fps/60ups), paused 19/20% cpu.
I find pausing the game resulting only in 5/6% cpu drop very poor.

Thats 1/5 of total cpu usage, that is removed while in paused mode.

Intel i7 3630QM 2.4ghz.


Well i found a work around to get it to use less cpu, i need to zoom in to maximum, en then pause the game.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 2:23 pm
by kovarex
rorror wrote:
Oxyd wrote:The game still renders when it's paused, so that takes some amount of CPU. If your hardware is not very fast, this might cause considerable CPU load.

Make sure you don't have any of the debug options enabled – they can take a lot of CPU to process.
With the debug off (it did for me only show ups fps, does for me not change cpu %)

When i play the game on full zoom window it uses 25%cpu (60fps/60ups), paused 19/20% cpu.
I find pausing the game resulting only in 5/6% cpu drop very poor.

Thats 1/5 of total cpu usage, that is removed while in paused mode.

Intel i7 3630QM 2.4ghz.


Well i found a work around to get it to use less cpu, i need to zoom in to maximum, en then pause the game.
Well, the rendering is not for free, and it is multithreaded, so it can take more cpu easily.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 2:49 pm
by mrvn
kovarex wrote:
rorror wrote:
Oxyd wrote:The game still renders when it's paused, so that takes some amount of CPU. If your hardware is not very fast, this might cause considerable CPU load.

Make sure you don't have any of the debug options enabled – they can take a lot of CPU to process.
With the debug off (it did for me only show ups fps, does for me not change cpu %)

When i play the game on full zoom window it uses 25%cpu (60fps/60ups), paused 19/20% cpu.
I find pausing the game resulting only in 5/6% cpu drop very poor.

Thats 1/5 of total cpu usage, that is removed while in paused mode.

Intel i7 3630QM 2.4ghz.


Well i found a work around to get it to use less cpu, i need to zoom in to maximum, en then pause the game.
Well, the rendering is not for free, and it is multithreaded, so it can take more cpu easily.
It should be nearly free. Simply create a texture of the screen when pausing or opening menues and use that as background instead of compositing the whole frame 60 times a second. And only refresh the screen when something changes.

Re: [0.15.18] High CPU usage when paused.

Posted: Mon Jul 03, 2017 6:19 pm
by lxx
kovarex wrote:Well, the rendering is not for free, and it is multithreaded, so it can take more cpu easily.
True that. But, maybe things can be optimized. Maybe render at a lower FPS when in menu/paused, if there's no input… or try to detect when the window is not visible and then skip the rendering.