Qt thread usage
-
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
, andtop -H -p <sleep-pid>
:
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:
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". -
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. -
@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.