Celestia's processor usage while in Full Screen

Report bugs, bug fixes and workarounds here.
Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Celestia's processor usage while in Full Screen

Post #1by Cham » 16.09.2006, 02:36

I just noticed something weird with both Celestia 1.4.2 and 1.5.0 (custom built). If I put the application in background, while in full screen mode and time stopped (with nothing special on screen), it's still using almost 100% of my processors time (dual system with OS X). Is this normal or a bug ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #2by ElChristou » 16.09.2006, 11:43

I suppose this is normal, myself I get 70 to 90% use... (Celestia is known to consume almost all the processor time if I'm not wrong...)
Image

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #3by selden » 16.09.2006, 12:29

Celestia does not try to optimize CPU usage when time is stopped. You might be changing the viewpoint, for example, using the mouse or keyboard. Adding all the tests so that calculations are done only when "something" changes would be quite a bit of work.

However, Celestia does no calculations when it is iconized under Windows. That's probably true under the other operating systems, too. Even this is risky, though. If you click on a Cel URL while Celestia is iconized, the view you'll see when you de-iconize it will be quite confused.
Selden

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #4by Cham » 16.09.2006, 15:03

Then why does Celestia using only 0.5 % processor time, while in windowing mode and in background, and 95% processor time if in full screen mode and in background ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #5by selden » 16.09.2006, 15:16

It sounds to me like the cpu% may be wrong.

What fps does Celestia claim? (and what is your screen's refresh rate?)

In general, Celestia uses 100% of the CPU unless it can finish drawing its window before the computer has to display the next screen.

In other words, if your system is refreshing the screen at 75Hz and Celestia's fps is less than 75 fps, then Celestia will use 100% of the CPU trying to keep up.

If vertical retrace sync is enabled in the graphics card and Celestia finishes computing its next display before it's time for the computer to show the next screen, then Celetia will pause while waiting for the next vertical retrace signal and it'll use less than 100% of the cpu.

If vertical retrace sync is disabled, then Celestia will use 100% of the cpu at all times, possibly creating new screens faster than the computer can.

[edit]
It could be that someone has implemented code in the Mac version of Celestia so that it stops trying to recalculate its window when the window is obscured. Certainly the Windows version of Celestia continues to use all of the CPU whether or not its window is obscured.
[/edit]
Last edited by selden on 16.09.2006, 15:24, edited 1 time in total.
Selden

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #6by dirkpitt » 16.09.2006, 15:23

Cham wrote:Then why does Celestia using only 0.5 % processor time, while in windowing mode and in background, and 95% processor time if in full screen mode and in background ?


That's weird, I'll try and test this tomorrow. I would expect however that the OS X Celestia only stops using CPU when hidden, not when it's in the background but the window is still visible.

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #7by Cham » 16.09.2006, 15:30

I forgot to tell that in both cases, Celestia was hidden in background (not viisible). In wondow mode, its cpu usage was less than 1%, while in fullscreen mode, it was about 90% and higher.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #8by dirkpitt » 17.09.2006, 06:44

I can definitely reproduce the issue. I'll have a go at fixing it today.

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #9by dirkpitt » 17.09.2006, 08:40

I fixed this in CVS. Please test and let me know.

Sui Ota
Posts: 75
Joined: 05.10.2005
With us: 19 years 1 month
Location: Saitama, Japan

Post #10by Sui Ota » 17.09.2006, 09:27

I tried new code, and I found another problem(I don't understand whether this bug is related of recent modifying.):
After turning into full screen mode, using Expos?©, and going back Celestia window, the display becomes black.
There is no way to put the display back in place :cry:
So I forced to reboot... I experienced this twice to do same steps!
(Sorry, I don't check the new feature yet because of this problem :oops: )

with iBook G4 12" released at July 22, 2005 and Mac OS X, 10.4.7

[edit]
I checked the low CPU usage with hidden full-screen Celestia window. :)
[/edit]
-Suι

phoenix
Posts: 214
Joined: 18.06.2002
With us: 22 years 5 months
Location: Germany - Berlin

Post #11by phoenix » 17.09.2006, 11:04

I don't know about the maxos build but the new fullscreen mode is perfect.
it's more like a windowed mode without a window.
so now I can run celestia in fullscreen and do whatever I want on my 2nd screen in dual-screen setup 8)
most recent celestia win32-SVN-build - use at your own risk (copy over existing 1.5.1 release)

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #12by dirkpitt » 17.09.2006, 14:31

Sui Ota wrote:I tried new code, and I found another problem(I don't understand whether this bug is related of recent modifying.):
After turning into full screen mode, using Expos?©, and going back Celestia window, the display becomes black.
There is no way to put the display back in place :cry:
So I forced to reboot... I experienced this twice to do same steps!
(Sorry, I don't check the new feature yet because of this problem :oops: )

with iBook G4 12" released at July 22, 2005 and Mac OS X, 10.4.7

[edit]
I checked the low CPU usage with hidden full-screen Celestia window. :)
[/edit]


Thanks for the report. I've managed to duplicate the Expos?© issue. For me, if I press F9 and then click on Celestia the screen goes black although by pressing every key combination I could think of I somehow managed to quit Celestia 8O What a harrowing experience! Maybe this should be called the Black Screen of Death(tm).

I'll check into it.

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #13by Cham » 17.09.2006, 14:53

EDIT : After several tries, while in fullscreen mode, I had the black screen of death. The issue is definitely here. I'm using Tiger 10.4.7.

I tested the fullscreen mode in background. The processors usage is now down to 4% (mean value). Much bettter, but still higher than if it's a window in background (hidden), which gives me about 0.5%, according to the process monitor.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #14by dirkpitt » 17.09.2006, 16:19

Black screen of death is now fixed in CVS.
It was caused by Celestia fading the screen to black when activated in Expose. Now it should only fade to black when switching to full screen mode. Oops. :)

I know the CPU usage isn't entirely eliminated in full screen mode, but a 100% effective fix looked rather messy to implement so I didn't bother. At the end of the day, does it seriously affect your work?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #15by selden » 17.09.2006, 16:30

Dirk,

Is there any chance the "hidden window" CPU reduction could be provided in the Windows version of Celestia?
Selden

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #16by Cham » 17.09.2006, 16:35

The black screen of death appears to be solved ! 8)

I tested a new built 2 min ago, using all the dashboard-expos?© tricks like crazy, and nothing bad happened !

However, I'm still wondering why stopping time, full screen mode in background (hidden) still gives 4% processors time. Okay, I'm a prefectionnist, I admit it !

Thanks for the good work, Dirkpitt !
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Sui Ota
Posts: 75
Joined: 05.10.2005
With us: 19 years 1 month
Location: Saitama, Japan

Post #17by Sui Ota » 18.09.2006, 15:12

The display no longer turns into dark!
(Oh, this was a by-product of testing low CPU usage!)
Thanks :D :D :D
-Suι

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #18by dirkpitt » 18.09.2006, 15:46

selden wrote:Dirk,

Is there any chance the "hidden window" CPU reduction could be provided in the Windows version of Celestia?


I'm not sure. I added event handlers for application hiding/unhiding to the OS X version but not sure if the Win32 api has such events that could be caught (and I thought Windows doesn't have a concept of "hiding", so by "hidden window" I guess you mean minimized?)

To be completely honest, even before adding the event handlers the OS X version would use only minimal CPU when not in full screen mode but hidden because of automatic OS "magic" (ie., the OS would just understand that a hidden window didn't need updating, and calculations are only set to trigger on window updates hence no CPU usage). Why this didn't work for the full screen window I still don't understand but it didn't seem worth losing sleep over.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #19by selden » 18.09.2006, 16:39

dirkpitt wrote:
selden wrote:Dirk,

Is there any chance the "hidden window" CPU reduction could be provided in the Windows version of Celestia?

I'm not sure. I added event handlers for application hiding/unhiding to the OS X version but not sure if the Win32 api has such events that could be caught (and I thought Windows doesn't have a concept of "hiding", so by "hidden window" I guess you mean minimized?)
No, I mean hidden :)
The Windows version of Celestia already stops using CPU when its window is minimized. I don't know anything about the Windows GUI API, so I don't know if it actually provides the necessary information.

A quick Web search shows that a Windows "hidden window" is one that's never drawn by design. "Fully occluded window" may be a more appropriate term, but I can't find anything about that.
Selden

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #20by dirkpitt » 19.09.2006, 03:34

selden wrote:"Fully occluded window" may be a more appropriate term


Ah, we are talking about two different things then.

"Hiding" a window is an actual operation that can be performed from any application's menu on OS X, and results in the app's windows disappearing from view (to be precise, they are removed from the global screen list).


Return to “Bugs”