Open carlocastoldi opened 2 years ago
Thanks for bringing it up! Implemented in https://github.com/SlyFabi/WSysMon/commit/51e24a94d4d9c3f7a9170ba87b29149a375c4052
Thank you a ton for this update! Makes WSysMon already better then standard GNOME's system monitor, to me.
Just one more thing:
While it's correct that flatpak applications are wrapped in (multiple) bwrap
containers, I think it's better to display the full name of the application instead of useless nested process names.
Also: comparing the results with systemd-cgls
I see some of the processes & subprocesses are not displayed. Example can be seen here in the screenshot with telegram. But apparently it also happens with firefox. Both are displayed as "Background" services under systemd
. Any idea why?
Fyi, here is systemd-cgls
firefox's tree:
│ │ ├─app.slice (#2444)
│ │ │ ├─app-gnome-firefox-184650.scope (#13396)
│ │ │ │ → user.xdg.inactive-since: 116173843733
│ │ │ │ ├─238167 /usr/lib/firefox/firefox
│ │ │ │ ├─238653 /usr/bin/python3 /usr/bin/gnome-browser-connector-host
│ │ │ │ ├─[...]
and gnome-text-editor's tree:
│ │ ├─app.slice (#2444)
│ │ │ ├─app-flatpak-org.gnome.TextEditor-185746.scope (#13544)
│ │ │ │ → user.xdg.inactive-since: 116950830678
│ │ │ │ ├─185746 bwrap --args 38 /app/bin/gnome-text-editor --gapplication-service
│ │ │ │ ├─185752 bwrap --args 38 xdg-dbus-proxy --args=40
│ │ │ │ ├─185753 xdg-dbus-proxy --args=40
│ │ │ │ └─185756 /app/bin/gnome-text-editor --gapplication-service
Finally: since the csgroup should use an appID that is unique and attributable to a .desktop
file, do you think it's possible to retrieve name and icons of the applications?
thanks a lot!
bwrap containers are now filtered with https://github.com/SlyFabi/WSysMon/commit/5494d99e4ca42f71180153322d268c000e8bfa91
Could you run ls /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/
and show me the output from there? On my machine everything is displayed except GNOME Terminal.
Yes, getting names and icons will be implemented but at a later date.
i still get bwrap entries in the "App" section. However, they are not expandable and the corresponding flatpak apps are visible as well.
That said I can't see the some child processes (see xdg-dbus-proxy
in my previous comment. They are displayed under bwrap in "Background").
Regarding firefox i dunno what happened, but it's now rightfully displayed in "Apps"!
On my machine everything is displayed except GNOME Terminal.
I as well can't see GNOME Terminal even tho it's in /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/
. Even weirder I can't even see in that same directory Geary or Nautilus. In systemd-cgls
they are in:
-.slice
├─user.slice (#208)
│ └─user-1000.slice (#2296)
│ ├─user@1000.service … (#2370)
│ │ ├─session.slice
│ │ │ ├─dbus.service (#10695)
│ │ │ │ ├─259318 /usr/bin/geary --gapplication-service
│ │ │ │ ├─352324 /usr/bin/nautilus --gapplication-service
However at that same depth they are sibilings with clearly other background services such as evinced
or gnome-calendar --gapplication service
.
On the contrary, in [...]/app.slice/
there are scopes that are background services and that I feel like they should not be considered as Apps:
app-gnome-org.gnome.Evolution\x2dalarm\x2dnotify-183925.scope
(/usr/lib/evolution-data-server/evolution-alarm-notify
)app-gnome-org.gnome.SettingsDaemon.DiskUtilityNotify-183915.scope
(/usr/lib/gsd-disk-utility-notify
)Yes, getting names and icons will be implemented but at a later date.
sure. It makes sense to first have a working structure
https://github.com/SlyFabi/WSysMon/commit/5a85c7c94173fe6ebfd9e9d51f7af88c22f7ee5e should contain some fixes.
I forgot to test Nautilus, you´re right it is not displayed. But the structure under dbus makes it very hard to code a universal solution. I could implement exceptions for everything but that would be very time consuming. Maybe there is another way?
I´ve created a list with background services which are excluded, so evolution etc. are no longer displayed in Apps.
Regarding xdg-dbus-proxy: it is not a child process of the application listed in cgtop. It is a seperate process, so technically it is correctly displayed.
https://github.com/SlyFabi/WSysMon/commit/5a85c7c94173fe6ebfd9e9d51f7af88c22f7ee5e should contain some fixes.
yeah, i just noticed that. You basically put some services in a blacklists. I see!
I forgot to test Nautilus, you´re right it is not displayed. But the structure under dbus makes it very hard to code a universal solution. I could implement exceptions for everything but that would be very time consuming.
Yeah, I imagined that the apps under dbus
seemed a bit hard to retrieve. To be fair they don't even seem to follow systemd's standard. Might be a bug from GNOME.
Maybe there is another way?
that said, you might be interested in this old KDE snippet: https://invent.kde.org/-/snippets/1111
If you (or gnome) started Nautilus/Geary correctly, it shows that WSysMon almost always finds it:
systemd-run --user --scope -u app-gnome-org.gnome.Nautilus-1205153.scope nautilus
This, however, also shows that WSysMon's parsing is a bit off. Technically an app could also be run with the following command and still follow the standard:
systemd-run --user --scope -u app-org.gnome.Nautilus-`uuidgen | sed s/\-//g`.scope nautilus
yet WSysMon assumes that the launcher is specified (between app
and the appID: org.gnome.Nautilus
). Moreover, it assumes that the random string after the appID is present (but it should be optional) and that it is digit only (but it could contain any char. -
excluded, I think)
I´ve created a list with background services which are excluded, so evolution etc. are no longer displayed in Apps.
I am afraid I don't fully understand this bit. What's the name of the list? I can't spot both evolution-alarm-notify
and gsd-disk-utility-notify
in "Background"
Regarding xdg-dbus-proxy: it is not a child process of the application listed in cgtop. It is a seperate process, so technically it is correctly displayed.
oh. Isn't it weird that i see it in the cgls
(not cgtop
) tree under a app-flatpak
scope then :O
Speaking of which: I think resource usage reported by WSysMon are a bit off. I'm having 3 windows open of firefox, with ~30 tabs open, and it reports i'm using only ~650MiB.
systemd-cgtop -m --depth=6
reports a much more believable 3.7G :grin:
I forgot to test Nautilus, you´re right it is not displayed. But the structure under dbus makes it very hard to code a universal solution. I could implement exceptions for everything but that would be very time consuming. Maybe there is another way?
actually, reading the snippet from KDE I saw that there is a nice way to get this info!
Apps launched through dbus have a .service
file in /usr/share/dbus-1/services/
. For example Nautilus's two (or more) possible dbus launchers:
~
❯ cat /usr/share/dbus-1/services/org.gnome.Nautilus.service
[D-BUS Service]
Name=org.gnome.Nautilus
Exec=/usr/bin/nautilus --gapplication-service
~
❯ cat /usr/share/dbus-1/services/org.freedesktop.FileManager1.service
[D-BUS Service]
Name=org.freedesktop.FileManager1
Exec=/usr/bin/nautilus --gapplication-service
I will look into it deeper, but it currently don´t have much time sadly.
Speaking of which: I think resource usage reported by WSysMon are a bit off. I'm having 3 windows open of firefox, with ~30 tabs open, and it reports i'm using only ~650MiB.
That´s weird. I´ve never encountered this on my devices while testing. Maybe some missing child processes?
I will look into it deeper, but it currently don´t have much time sadly.
got it. Dw, I don't have a hurry. I may even help after I graduated 8)
That´s weird. I´ve never encountered this on my devices while testing. Maybe some missing child processes?
I'd say that's a reasonable option. If i open up GNOME system monitory it also reports numbers that, if summed up, are closer to the one reported by cgtop
If use cgroup v2, /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice
not found, because it not use cgroup v1, so app not show any process.
At cgroup v2 it in /sys/fs/cgroup/unified/user.slice/user-1000.slice
, such as arch and nixos use it.
The usage of cgroups to manage processes by DEs is an innovative approach pushed forward by both KDE & GNOME, and uses the application's ID to distinguish the various resources.
If you're interested in this approach i suggest you to read about the standard.
An axample of it usage can be seen running
systemd-cgtop
(e.g.systemd-cgtop -m --depth=6
) andsystemd-cgls
. This is what KDE Plasma uses with Plasma System Monitor (see this old bug report)