High CPU load in background

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

High CPU load in background

Post by _mental_ »

I have just noticed that the game consumes one CPU core at 100% while in background.
The game state doesn't matter, even in the main menu CPU load will jump to top from a few percent when the game window loses focus.

The version 2.8pre-804 is OK, but 2.8pre-807 already has the mentioned problem.
It was quite easy to reveal that it's because of this commit.

It doesn't really matter on desktop, but for mobile users this may be an issue. I noticed that because of a fan noise while ZDoom's window was minimized.
It looks more like a bug rather than a "feature". What do you think, edward850?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: High CPU load in background

Post by Graf Zahl »

Oh, it does matter on desktop. I noticed it too, yesterday, when launching two instances of GZDoom in parallel. Normally this wouldn't have caused any problems but with both running at full load it nearly ground my system to a halt.

So, two options:

a) a reasonable fix is provided
b) the commit is reverted.

I can't accept the current behavior.
Gez
 
 
Posts: 17943
Joined: Fri Jul 06, 2007 3:22 pm

Re: High CPU load in background

Post by Gez »

How about conditioning the new behavior to be only enabled when playing or recording a demo?
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: High CPU load in background

Post by edward850 »

After toying with the rewind function a little bit, I think I may have a grasp on what the actual bug was. Something about how g_ticker is key control for pausing everything, despite itself being a critcal aspect doesn't make much sense, and it's screwing with player input a lot. It needs to stop running the playsim entirely, while still ticking.

Unless someone beats me to it, I may restructure it a little bit to make it more sane. (And maybe make timedemo a little less fatal.)

As for why my current fix is causing problems? I honestly never noticed them. It doesn't seem to cause any sort of unreasonable load on my system.
Funny that.
User avatar
Csonicgo
Posts: 1193
Joined: Thu Apr 15, 2004 3:28 pm
Location: Leeds

Re: High CPU load in background

Post by Csonicgo »

It turns the Pi into a small oven, so there's that.
User avatar
Enjay
 
 
Posts: 26993
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: High CPU load in background

Post by Enjay »

So, you're cooking the Pi?

No idea why, but I'm just not getting this problem. I can run multiple instances of ZDoom or GZDoom, windowed or not and still have a perfectly responsive machine.

Image
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: High CPU load in background

Post by Graf Zahl »

Amazing that it's still responsive with this high CPU load... If you add up the percentages you are at 100%.
User avatar
Enjay
 
 
Posts: 26993
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: High CPU load in background

Post by Enjay »

Well, there's 2% left over... :lol:

No idea why it was still working fine and, although I don't remember what the values were, presumably some of the other processes were doing something that had a CPU load.

I know it sounds like a silly question but can the CPU usage as reported in the task manager go above 100%? I know CPU usage can't actually be above 100% but perhaps there is something about how usage is reported?

[edit]
My computer got a little bit choppy this time as it flitted between giving attention to different instances but, once I had a particular game in focus, I was still able to play that copy of the game (Doom2 map01) with no obvious difficulties:
Spoiler:
Gez
 
 
Posts: 17943
Joined: Fri Jul 06, 2007 3:22 pm

Re: High CPU load in background

Post by Gez »

Any statistics can go above 100% due to rounding effects.

To give a simple example: Suppose you have 15 processes and they all inflict a perfectly identical workload on the CPU. 100/15=6.66666666666....% The CPU usage function reports an integer, so it rounds it up to 7%. Then when you make the tally, 15*7=105, so the reported CPU load is 105%.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: High CPU load in background

Post by randi »

Enjay wrote:once I had a particular game in focus, I was still able to play that copy of the game (Doom2 map01) with no obvious difficulties:
Windows gives a slight priority boost to the application with the active window, so that's probably why.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: High CPU load in background

Post by Graf Zahl »

Will anything be done about this? It's really annoying and if nothing happens I'll be forced to undo it as it causes a shitload of problems if the game is put in the background.

Here's another one:

http://forum.drdteam.org/viewtopic.php?f=24&t=6527
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: High CPU load in background

Post by edward850 »

User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: High CPU load in background

Post by Graf Zahl »

I'll check this evening.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: High CPU load in background

Post by Graf Zahl »

Applied, now I need to run some tests.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: High CPU load in background

Post by _mental_ »

Can't test on Windows at the moment, but on OS X the issue is gone.
Taking into account that excessive CPU load was caused by a busy loop in common code, the problem should be solved for all platforms. Running multiple instances should be smooth now.
Post Reply

Return to “Closed Bugs [GZDoom]”