Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Regarding the CPU Usage in arm board for an example of QTableView while scrolling

Regarding the CPU Usage in arm board for an example of QTableView while scrolling

Scheduled Pinned Locked Moved Unsolved General and Desktop
28 Posts 5 Posters 7.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #12

    I meant the data model

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    Pradeep KumarP 1 Reply Last reply
    0
    • SGaistS SGaist

      I meant the data model

      Pradeep KumarP Offline
      Pradeep KumarP Offline
      Pradeep Kumar
      wrote on last edited by
      #13

      @SGaist

      can u brief me up regarding the data model. what is it.?.

      Pradeep Kumar
      Qt,QML Developer

      jsulmJ 1 Reply Last reply
      0
      • Pradeep KumarP Pradeep Kumar

        @SGaist

        can u brief me up regarding the data model. what is it.?.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #14

        @Pradeep-Kumar From your first post: "i have used QStandardItemModel as a model" - so I guess the question is how big is this model (how many elements does it contain)?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by
          #15

          The standard item model data was having 3 columns and the rows values depends on DB values. it will increase as per the db values.

          Pradeep Kumar
          Qt,QML Developer

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #16

            Then what is the usual size of your database ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #17

              Without Db also i tried the same, again i have observed the CPU % gradually increases to 100%. i didnt understand the behaviour. please guide me.

              Pradeep Kumar
              Qt,QML Developer

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #18

                Without any test case to run, it's pretty much impossible to help you get further. There's also no information about what else is running on your target or what your application does that might or might not be influenced by what happens in your GUI.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • Pradeep KumarP Offline
                  Pradeep KumarP Offline
                  Pradeep Kumar
                  wrote on last edited by
                  #19

                  Their was some daemon process running, when i checked the application.

                  Pradeep Kumar
                  Qt,QML Developer

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #20

                    Use top to see which is the processor hog: Likely your application but you have to verify to be sure.

                    After that confirmation, it would also be useful if you could describe precisely how you trigger that CPU load.

                    On a side note: which version of Qt are you using ? With which plugin ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • Pradeep KumarP Offline
                      Pradeep KumarP Offline
                      Pradeep Kumar
                      wrote on last edited by
                      #21

                      I will check the process bu using command top.
                      I am using Qt version 5.7.

                        <After that confirmation, it would also be useful if you could describe precisely how you trigger that CPU load.>
                      

                      I didnt get the above statement.

                      Pradeep Kumar
                      Qt,QML Developer

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #22

                        After you confirmed that the CPU hog is indeed your application. It would be useful that you describe precisely what you do that makes the CPU go wild.

                        You didn't wrote which plugin you were using for your application. xcb ? wayland ? eglfs ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • Pradeep KumarP Offline
                          Pradeep KumarP Offline
                          Pradeep Kumar
                          wrote on last edited by
                          #23

                          Sorry about that missed to inform the plugin, I am using .xcb plugin.

                          Pradeep Kumar
                          Qt,QML Developer

                          1 Reply Last reply
                          0
                          • Pradeep KumarP Offline
                            Pradeep KumarP Offline
                            Pradeep Kumar
                            wrote on last edited by
                            #24

                            Here is link of the screenshot of the cpu usage of the application
                            Application name is TableViewExample

                            https://postimg.org/image/awmpgc3wt/

                            Pradeep Kumar
                            Qt,QML Developer

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #25

                              Which one of the QTableView example ? This one ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • Pradeep KumarP Offline
                                Pradeep KumarP Offline
                                Pradeep Kumar
                                wrote on last edited by
                                #26

                                Yes I have used QTableView , the example , and for the model i have used QStandardItemModel.
                                I will post the code.

                                m_pushButton = new QPushButton("Click To Get Data");
                                
                                m_standardModel = new QStandardItemModel;
                                m_standardModel->setColumnCount(2);
                                m_standardModel->setRowCount(2000);
                                m_standardModel->setHorizontalHeaderItem(0,new QStandardItem("First Column"));
                                m_standardModel->setHorizontalHeaderItem(1,new QStandardItem("Second Column"));
                                
                                m_tableview = new QTableView;
                                m_tableview->setVisible(false);
                                

                                connect(m_pushButton,SIGNAL(clicked()),this,SLOT(getData()));

                                I have created Object in constructor Above lines of code.
                                And when i click the PushButton, i will be calling getData();

                                void getData()
                                {
                                int column_Count = 0;
                                int row_Count = 0;

                                QStandardItem *item,*item2;
                                
                                for(row_Count=0;row_Count<=2000;row_Count++)
                                {
                                    item = new QStandardItem("Qt");
                                    m_standardModel->setItem(row_Count,column_Count,item);
                                
                                    item2 = new QStandardItem("Company");
                                    m_standardModel->setItem(row_Count,column_Count+1,item2);
                                }
                                
                                m_tableview->setModel(m_standardModel);
                                m_tableview->setVisible(true);
                                

                                }

                                Pradeep Kumar
                                Qt,QML Developer

                                1 Reply Last reply
                                1
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #27

                                  Did you check at which number of rows the CPU starts to go under heavy load ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • thamT Offline
                                    thamT Offline
                                    tham
                                    wrote on last edited by tham
                                    #28

                                    It is hard to tell the bottleneck without test, but I would like to share some experiences of QStandardItemModel vs custom model.

                                    I have used QStandardItemModel and QTableView to create a rename tool before, the performance is quite horrible, even there are only several thousands of items(two column, original name vs name after changed), the speed could be very slow.

                                    To alleviate the problem, I use QAbstractTableModel to replace QStandardItemModel, after that, I can handle one million data without lag for most of the rename operations(most of them can show the results after rename on the second column instantly).

                                    In my custom model, I prefer QStringList(maybe std::vector<QString> would be faster) to store the data. I do not know the data structure underhood QStandardItemModel, but I guess it is some sort of tree like structure since QStandardItemModel need to be a universal model suit for every view, I suspect cache miss is the main reason why QStandardItemModel is so slow.

                                    Because of this experiences, I only prefer QStandardItemModel if

                                    1 : I know the size of the data are very small(less than two thousand rows)
                                    2 : Running out of development fee(Customer do not want to pay for performance)

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved