CPU Usage going high during user operation



  • Hello,

    I did run a test Qt application on my ARM based Embedded plaform.

    Qt application had a simple table, and another one with simple list with pre populated data of about 2000 rows.

    When I scroll the list using the scrollbar, up and down, continuously, I see that CPU is hitting about 70%.

    This looks monstrous because it is not just my application going to run on the system.

    There are other monsters would take 50-60% of CPU.

    So, question is, why Qt embedded application is taking more CPU during the rigorous UI operation.

    My understanding is that, that could be because of parent QWidget's paint (default). How do I make my application lite?

    Thanks,
    Kumara


  • Moderators

    @kumararajas said:

    My understanding is that, that could be because of parent QWidget's paint (default). How do I make my application lite?

    First of all you should really pin down the problem. Since performance can be lost almost everywhere.

    You may want to check with a simple test application if this is really a Qt problem. Event the choice of data structure to store your 2000 rows may already influence it.
    And avoid using QStandardItem-Framework when dealing with such an amount of data.



  • @raven-worx Just to add, I did not write any test application.

    Instead I have used two examples - 1) TI's QML based Playground application 2) Anamoly example.

    Both when scrolling, I see that CPU reaches to 90% as well.

    This is an example application provided by Qt, and that eats the CPU.

    What I should do differently, to optimize the CPU usage?

    Thanks!


  • Moderators

    @kumararajas
    what are the specs of your ARM system?



  • @raven-worx My hardware follow similar specs as AM335x EVM

    Fewer Details -

    Up to 1-GHz Sitara™ ARM® Cortex®-A8 32-Bit 
    512MB of RAM
    

    Thanks!



  • Adding to this,

    I wrote a simple application, that has a tableview, and it contains 25 rows, prefilled with some data.

    I ran this application on the embedded board.

    On idle state, CPU usage was 0%, occasionally 1%.

    When I scroll down the list slowly, I see that CPU was about 5%, which is a decent score.

    When I scroll up and down the list, rigorously, I see that CPU usage is shooting to 50% or even more.

    What is puzzling me is, this is a simple app, and is that Qt failed to optimize the implementation?

    I am sure, I can do some tricks like, when move the slider, not to update the tableview and update only when slider is released. All those would definitely improve a bit.

    But, these are all part of optimizations.

    A simple tableview code, may be of 20 lines maximum, will end up having 100 lines of code for improving the performance. But, question is, why every Qt user has to implement this 100 lines of code to have efficient implementation? Why not Qt do such implementation by default?

    I know I have poured off plenty of thoughts. (May be feeling pressure here? :P)

    Please let me know your thoughts.

    Thanks!

    Kumara


  • Moderators

    @kumararajas
    seems like this is something for the devs, so you should post it on the Qt dev mailing list
    If you do so, please keep this post updated for others looking for the same issue.



  • Thanks for the response!

    Can you please also share me the details about Qt dev mailing list?

    Thanks!



  • Adding to my experiments,
    I have created a blank application, dragged up tablewidget and prepopulated about 30 rows. Built the app and ran it on my target.
    It showed up the scroll bar. I dragged the scroll bar handle up and down continuously.
    And I saw the CPU shooted up to 61%.

    Is it the expected behaviour?



  • Any further thoughts?

    Thanks,
    Kumara


  • Lifetime Qt Champion

    The interest mailing list is followed by the Qt developers/maintainers.

    You should also benchmark with QTableView and a custom model.



  • Yes I did!

    That's where I have started up. I had QTableView with my own model, that was shooting up the CPU usage, at times, to 99% as well.
    Then I started to dig in and found that simple application with scrollbar, sample Qt applications also take high CPU.

    For example, slider example in Qt directory, cross compiled and ran it on the target. When I operate the scroll bar, CPU usage reaches 67% easily.

    I am thinking if its a bug in scrollbar code?


  • Lifetime Qt Champion

    There might be something sub-optimal going on.



  • This is still an open point. Any thoughts on this?

    Is it a bug in Qt that on scrolling, it consumes high cpu?

    I also see a Qt bug report - https://bugreports.qt.io/browse/QTBUG-57550


  • Lifetime Qt Champion

    With 5.9 / 5.10 ?



  • @SGaist Sam! Neither of that. I am still on ancient age 4.8.7 :)


  • Lifetime Qt Champion

    Do you know at which points is start to slow down ?



  • @SGaist Just have a decently big project tree, about 50 branches, with 50 children each.
    Just press and hold the down arrow in the scroll bar, we can observe that CPU % usage will constantly increment.

    In Ubuntu, we can see that it is a gradual increment.

    In case of AM335x, we can see that it shoots up to 60%.
    One other operation - Just drag the scrollbar handle up and down continuously, Ubuntu can go up to 30%, AM335x can go to 80%.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.