Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. Qt thread usage

Qt thread usage

Scheduled Pinned Locked Moved Unsolved The Lounge
3 Posts 3 Posters 449 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.
  • J Offline
    J Offline
    JonB
    wrote on 13 Apr 2023, 07:52 last edited by JonB
    #1

    OK, so here I am trying to analyse thread/CPU usage of my Qt program under Linux (Ubuntu, GNOME, and I never know whether it's Xorg or Wayland!).

    I start off with a simple sleep 100, and top -H -p <sleep-pid>:
    Screenshot from 2023-04-13 08-36-07.png

    So 1 thread. Good, I am happy with that :)

    Now I launch my Qt widgets application. At this point just single-threaded. And this is what I see:
    Screenshot from 2023-04-13 08-39-42.png

    You what?! That is 5 extra threads in addition to my program! No wonder my 4 processors are not enough as I want....

    Would someone care to give a one-line summary of what QXcbEventQueue, gmain, dconf worker, gdbus & QDBusConnection are each about, what they do? :) I know I could Google this all, but I prefer to hear it from you peeps.

    These are actual threads spawned from my Qt program, not say separate processes communicated with over sockets/shared memory, right? And they are threads, not processes, so how do they get a Command name like shown in that COMMAND column? man top does not explain to me what the COMMAND column displays when in "-H :Threads-mode operation".

    S K 2 Replies Last reply 13 Apr 2023, 20:35
    0
    • J JonB
      13 Apr 2023, 07:52

      OK, so here I am trying to analyse thread/CPU usage of my Qt program under Linux (Ubuntu, GNOME, and I never know whether it's Xorg or Wayland!).

      I start off with a simple sleep 100, and top -H -p <sleep-pid>:
      Screenshot from 2023-04-13 08-36-07.png

      So 1 thread. Good, I am happy with that :)

      Now I launch my Qt widgets application. At this point just single-threaded. And this is what I see:
      Screenshot from 2023-04-13 08-39-42.png

      You what?! That is 5 extra threads in addition to my program! No wonder my 4 processors are not enough as I want....

      Would someone care to give a one-line summary of what QXcbEventQueue, gmain, dconf worker, gdbus & QDBusConnection are each about, what they do? :) I know I could Google this all, but I prefer to hear it from you peeps.

      These are actual threads spawned from my Qt program, not say separate processes communicated with over sockets/shared memory, right? And they are threads, not processes, so how do they get a Command name like shown in that COMMAND column? man top does not explain to me what the COMMAND column displays when in "-H :Threads-mode operation".

      S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 13 Apr 2023, 20:35 last edited by
      #2

      Hi,

      From an educated guess:
      QXcbEventQueue is a thread to communicate with the XCB event loop.
      gmain is likely related to the GLib event loop
      QDbusConnection is likely used to discuss stuff with the system through DBus.

      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
      1
      • J JonB
        13 Apr 2023, 07:52

        OK, so here I am trying to analyse thread/CPU usage of my Qt program under Linux (Ubuntu, GNOME, and I never know whether it's Xorg or Wayland!).

        I start off with a simple sleep 100, and top -H -p <sleep-pid>:
        Screenshot from 2023-04-13 08-36-07.png

        So 1 thread. Good, I am happy with that :)

        Now I launch my Qt widgets application. At this point just single-threaded. And this is what I see:
        Screenshot from 2023-04-13 08-39-42.png

        You what?! That is 5 extra threads in addition to my program! No wonder my 4 processors are not enough as I want....

        Would someone care to give a one-line summary of what QXcbEventQueue, gmain, dconf worker, gdbus & QDBusConnection are each about, what they do? :) I know I could Google this all, but I prefer to hear it from you peeps.

        These are actual threads spawned from my Qt program, not say separate processes communicated with over sockets/shared memory, right? And they are threads, not processes, so how do they get a Command name like shown in that COMMAND column? man top does not explain to me what the COMMAND column displays when in "-H :Threads-mode operation".

        K Offline
        K Offline
        Kent-Dorfman
        wrote on 16 Apr 2023, 01:54 last edited by
        #3

        @JonB said in Qt thread usage:

        Ubuntu, GNOME, and I never know whether it's Xorg or Wayland!).

        Personally I'd strip the guts out of it to make sure that wayland crap is thoroughly disabled and then throw gnome out the nearest air-lock...then run my test under a minimalist window manager: ie twm, fvwm, openbox, etc.

        1 Reply Last reply
        1

        3/3

        16 Apr 2023, 01:54

        • Login

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