Unexplained high CPU usage for simple graphics

View: New views
7 Messages — Rating Filter:   Alert me  

Unexplained high CPU usage for simple graphics

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Our desktop Java3D application is suffering from very sluggest responsiveness and during testing we found that even the standard rotating cube example program would result in 50% CPU usage in the JVM (100% if two instances were run).  When the test was repeated on the same machine to gather further information for this post the CPU issue disappeared.  What things could possibly cause this behavior and how can we diagnose it?
[Message sent by forum member 'petroslj' (petroslj)]

http://forums.java.net/jive/thread.jspa?messageID=285033

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Unexplained high CPU usage for simple graphics

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A possible explanation is that in one station it is running free, thousand of frames per second, with very high CPU usage, and in another station it is running synch with video refresh,i.e., 60 fps.

VSynch can be enabled/disabled in your video card control panel, but you can set your Java3D application to run in lower fps and use less CPU:

[code]
// Ensure at least 5 msec per frame (i.e., < 200Hz)
  universe.getViewer().getView().setMinimumFrameCycleTime(5);
[/code]

or

[code]
// Ensure at least 10 msec per frame (i.e., < 100Hz)
  universe.getViewer().getView().setMinimumFrameCycleTime(10);
[/code]
[Message sent by forum member 'zesharp' (zesharp)]

http://forums.java.net/jive/thread.jspa?messageID=285056

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Unexplained high CPU usage for simple graphics

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

By the way, you can use Fraps to get FPS and detect the "out of control" FPS issue.
[Message sent by forum member 'zesharp' (zesharp)]

http://forums.java.net/jive/thread.jspa?messageID=285057

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Unexplained high CPU usage for simple graphics

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Free running FPS is certainly a possibility since the "sample" program may not be written properly for this case.  I will check the video setting and also try to locate the source code for the sample program to assess this possibility.
[Message sent by forum member 'petroslj' (petroslj)]

http://forums.java.net/jive/thread.jspa?messageID=285066

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Unexplained high CPU usage for simple graphics

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Reproduced the problem using example program HelloUniverse from
https://j3d-webstart.dev.java.net/test.  
Using an NVIDIA with vertical sync "forced on" causes 50% CPU usage, with vertical sync "forced off" sample uses 2-5% CPU.  Just the opposite of the expected result!  Obviously something is amiss here.
Looking for sample's source code next.
[Message sent by forum member 'petroslj' (petroslj)]

http://forums.java.net/jive/thread.jspa?messageID=285085

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Unexplained high CPU usage for simple graphics

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is a long-standing limitation of the way NVIDIA handles flushing the graphics pipe when sync-to-vertical retrace is enabled. Rather than waiting for an interrupt, which they should do, they go into a spin-loop that eats up CPU time.

-- Kevin
[Message sent by forum member 'kcr' (kcr)]

http://forums.java.net/jive/thread.jspa?messageID=285086

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Unexplained high CPU usage for simple graphics

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thats ugly.
NVIDIA vertical sync wait loop causes the high CPU when enabled,
the free running FPS causes high CPU when sync is off, and
results vary from machine to machine.

Only solution I have found that works for all our machines is to disable vertical sync and setMinimumFrameCycleTime().
[Message sent by forum member 'petroslj' (petroslj)]

http://forums.java.net/jive/thread.jspa?messageID=285113

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...