PDA

View Full Version : Excess CPU usage during Paint



vairamuthu.g
16th March 2009, 11:38
My application requires to display data graphically and also has certain functionality like zoom and panning through the data.

I also require the same design to show real time data read from a device, Although code for this task is not in place and we have already got an issue with the static data display.

The issue is while application is displaying the graph on the screen, i see that there is sudden jump in the CPU usage, from 40- 60% and is remaining there till i remove the application moves to another screen where there is no graphics involved.

I am using QGraphicsItem and overridden paint to use QPainter object for drawing.

Is excessive usage of CPU with QGraphicsItem a common thing with Qt?
If not, am i doing anything wrong to make system use so much of CPU time?
If yes, are there any measures to take, to make the application perform better, as far as CPU usage is concerned?
Also, please let me know i am not clear in explaining the issue.

Qt version: Qt 4.4.3
Target OS: Windows XP, Vista and Mac

Thanks and Regards,
Muthu.

pckoster
17th March 2009, 09:59
You don't have some sort of painting refresh loop running when displaying static data? Try debugging that first. It is normal if not displaying the scene, that the CPU usage will drop. What is your desired 'refresh rate' for the real-time DAQ?

As I cannot see how many items you are using and the relevant code examples therefore, I can only give some basic ideas on performance, from my own experience:

- Try disabling any QPen instances in use, as they will greatly affect performance.

- Try painting on an OpenGL widget by invoking setViewport(new QGLWidget) on the associated QGraphicsView.