PDA

View Full Version : Reducing CPU Usage



Kapil
28th April 2006, 08:21
Hi...

My application has become very heavy.. now i know how to improve the memory constraints but when it compes to the CPU Usage, its out of control...

Whenever i run my exe it gives the CPU usage as 100% which make the system very slow till the application is under execution.. i cannot switch between different applications...
how do i improve on that...
Please help me on this..

Thanking you...

with regards,
Kapil

zlatko
28th April 2006, 09:02
What your app do?
Maiby you have perpetual cycle in your code?

wysota
28th April 2006, 10:18
First of all, compile in release mode and see if it helps. Then compile in debug again with profiling data enabled and use some profiler to see which parts of code take the most time to execute and which are executed most frequently. Then try to improve them.

Kapil
28th April 2006, 10:59
hi...

i tried using it in the release mode but the same output...

checking on the loops and putting check conditions helps me improve the running time of it... but shows the CPU Usage as 100%..
i tried with a smaller part for it... though it runs for lesser time but whatever time it runs, it uses 100% CPU...

what should help me in reducing that...

the reduction of loops and memory help me in improving the running time and the memory usage complexities...

with regards,
Kapil

Kapil
28th April 2006, 11:01
What your app do?
Maiby you have perpetual cycle in your code?

my application uses a QCanvas which draws a big chip layout and then higlights the solution on the chip....

i checkd thru it but exactly am not able to make out what is making it use 100% cpu...

Even the compilation tends to take major part of the CPU... why is it so????

Kapil

mickey
28th April 2006, 11:15
maybe some cycles, eg. connect from a timeout() to a repaint(), update() or a function that restart the timer ??? Try to put printf("something\n") everywhere.....

wysota
28th April 2006, 12:02
hi...

i tried using it in the release mode but the same output...

checking on the loops and putting check conditions helps me improve the running time of it... but shows the CPU Usage as 100%..
i tried with a smaller part for it... though it runs for lesser time but whatever time it runs, it uses 100% CPU...

what should help me in reducing that...

the reduction of loops and memory help me in improving the running time and the memory usage complexities...

with regards,
Kapil

Use a profiler. Like gprof for gcc/mingw. Why do things manually if there are tools for that?

Kapil
29th April 2006, 09:01
Hi..

i was able to figure out the problem.. it was because of the immense use of the objects...
i have posted a different thread which talks about it in details in the Newbie as i thought it was not right for me to post it in this sections....

Basically what i want to achieve is that create something like using one line object create 1000 lines which earlier i was doing using 1000 lines... it doesn't seem to work out when i tried..

Or is there a solution to this problem which can help me creating 1000 lines using min objects...

Thanking you..

Kapil

goli
3rd April 2011, 15:43
i have the same problem with qml animations. when i use qml animations the CPU consumption rises significantly(up to 50%). any ideas?....