Results 1 to 9 of 9

Thread: Reducing CPU Usage

  1. #1
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Reducing CPU Usage

    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
    All you have to decide is what to do with the time that is given to you

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Reducing CPU Usage

    What your app do?
    Maiby you have perpetual cycle in your code?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Reducing CPU Usage

    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.

  4. #4
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reducing CPU Usage

    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
    All you have to decide is what to do with the time that is given to you

  5. #5
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reducing CPU Usage

    Quote Originally Posted by zlatko
    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
    All you have to decide is what to do with the time that is given to you

  6. #6
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Reducing CPU Usage

    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.....
    Regards

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Reducing CPU Usage

    Quote Originally Posted by Kapil
    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?

  8. #8
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reducing CPU Usage

    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
    All you have to decide is what to do with the time that is given to you

  9. #9
    Join Date
    Apr 2011
    Posts
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reducing CPU Usage

    i have the same problem with qml animations. when i use qml animations the CPU consumption rises significantly(up to 50%). any ideas?....

Similar Threads

  1. Bad memory usage on QWebView I think
    By jiturra in forum Qt Programming
    Replies: 15
    Last Post: 21st January 2014, 20:35
  2. rotate operation and cpu usage
    By ersin.ozkan in forum Qt Programming
    Replies: 2
    Last Post: 30th December 2008, 06:42
  3. QThread usage and exec()
    By smahnken in forum Qt Programming
    Replies: 10
    Last Post: 24th August 2008, 18:13
  4. CPU Time & Memory Usage in QThread or QProcess
    By Davidaino in forum Qt Programming
    Replies: 0
    Last Post: 11th July 2008, 19:15
  5. CPU and Memory Usage
    By philwinder in forum Qt Programming
    Replies: 16
    Last Post: 17th May 2008, 22:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.