Resources uses too much resources (constant high CPU usage)
Is there an existing issue for this?
- [x] I searched the existing issues and did not find anything similar.
Current Behavior
On my Intel Kabylake graphics laptop running GNOME 47.4's Wayland (non-HiDPI) session on Fedora 41, with the latest Resources version from flathub and default settings other than telling Resources to not divide CPU usage by the number of vCores, I see this:
On my machine, when refresh speed is set to "Normal", Resources consumes 12 to 25% of the 8 vCPUs on my Intel i5-8350U × 8 CPU. I'd expect 2-3% at most. Even when setting refresh speed to "Very low", CPU usage remains unexpectedly high.
Expected Behavior
Other system monitoring apps like btop, Astra Monitor, GNOME System Monitor (when set to slow refresh intervals and not hovering the processes list with the mouse), etc., do not consume as much CPU as this.
I'd expect Resources to be more efficient at normal-to-high refresh speeds (but high refresh speeds are questionable).
When refresh speed is set to "Very Low", Resources' CPU usage would be expected to be near zero.
Steps to Reproduce
- Launch the app
- Go to the "Apps" list, sort by memory or by CPU usage, but memory is easier to have a stable view
- Observe Resources' high CPU usage
Debug Logs
Expand logs
DEBUG resources::utils > Running as Flatpak
INFO resources::application > Resources (net.nokyan.Resources)
INFO resources::application > Version: 1.8.0 ()
INFO resources::application > Datadir: `/app/share/resources`
DEBUG resources::application > Operating system: Fedora Linux 41 (Workstation Edition)
DEBUG resources::application > Kernel version: 6.12.15-200.fc41.x86_64
DEBUG resources::utils::gpu > Searching for GPUs…
DEBUG resources::utils::pci > Parsing pci.ids…
INFO resources::utils::pci > Successfully parsed pci.ids within 15.40ms (vendors: 2427, devices: 19383, subdevices: 16824)
INFO resources::utils::gpu > Found GPU "UHD Graphics 620" (Identifier: 0000:00:02.0 · PCI ID: 8086:5917 · Category: Intel)
DEBUG resources::utils::gpu > 1 GPUs found
DEBUG resources::utils::app > Detecting installed apps
DEBUG resources::utils::app > Using the following directories for app detection: ["/app/share/applications", "/usr/share/applications", "/usr/share/runtime/share/applications", "/run/host/user-share/applications", "/run/host/usr/share/applications", "/run/host/share/applications", "/app/local/share/applications", "/usr/local/share/applications", "/usr/local/share/runtime/share/applications", "/run/host/usr/local/share/applications", "/run/host/local/share/applications", "/var/lib/flatpak/exports/share/applications", "/home/my_username/.local/share/flatpak/exports/share/applications", "/var/lib/snapd/desktop/applications", "/home/my_username/.local/share/applications"]
DEBUG resources::utils::app > Using the following locales for app names and descriptions: ["en_CA.UTF-8", "en_CA", "en"]
DEBUG resources::utils::app > Found native app "Resources" (ID: "net.nokyan.Resources") at /app/share/applications/net.nokyan.Resources.desktop with commandline `resources` (detected executable name: resources)
[snip, too much information]
DEBUG resources::utils::app > Found native app "Xwayland" (ID: "org.freedesktop.Xwayland") at /run/host/usr/share/applications/org.freedesktop.Xwayland.desktop with commandline `/usr/bin/Xwayland -decorate -displayfd 1` (detected executable name: Xwayland)
DEBUG resources::utils::app > Skipping gnome-network-panel because it's blocklisted (Technical application)
DEBUG resources::utils::app > Skipping gnome-applications-panel because it's blocklisted (Technical application)
DEBUG resources::utils::app > Found native app "Web" (ID: "org.gnome.Epiphany") at /run/host/usr/share/applications/org.gnome.Epiphany.desktop with commandline `epiphany %U` (detected executable name: epiphany)
DEBUG resources::utils::app > Skipping gnome-display-panel because it's blocklisted (Technical application)
DEBUG resources::utils::app > Skipping gnome-wifi-panel because it's blocklisted (Technical application)
DEBUG resources::utils::app > Skipping gnome-mouse-panel because it's blocklisted (Technical application)
[snip, too much information]
INFO resources::utils::app > Detected 235 apps within 49.27ms
DEBUG resources::utils::cpu > CPU temperature sensor located at "/sys/class/hwmon/hwmon8/temp1_input" (coretemp, type: hwmon)
DEBUG resources::utils::memory > Memory information obtained using udevadm
DEBUG resources::utils::npu > Searching for NPUs…
DEBUG resources::utils::npu > 0 NPUs found
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:782: FINISHME: support YUV colorspace with DRM format modifiers
MESA-INTEL: warning: ../src/intel/vulkan/anv_formats.c:814: FINISHME: support more multi-planar formats with DRM modifiers
DEBUG resources::utils::process > Spawning resources-processes in Flatpak mode (/home/my_username/.local/share/flatpak/app/net.nokyan.Resources/x86_64/stable/0b53192f7350cb38b5f502cbc408f76ce0e94077f0fb76c88a2af2e82465dfb3/files/libexec/resources/resources-processes)
DEBUG resources::utils::app > Associating process 3073927 with app "Pika Backup" (ID: "org.gnome.World.PikaBackup") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3073929 with app "Events and Tasks Reminders" (ID: "org.gnome.Evolution-alarm-notify") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3074431 with app "Pika Backup" (ID: "org.gnome.World.PikaBackup") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3074432 with app "Pika Backup" (ID: "org.gnome.World.PikaBackup") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3074436 with app "Pika Backup" (ID: "org.gnome.World.PikaBackup") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3074445 with app "Pika Backup" (ID: "org.gnome.World.PikaBackup") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3074507 with app "Portal" (ID: "xdg-desktop-portal-gnome") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3074569 with app "Portal" (ID: "xdg-desktop-portal-gtk") based on process cgroup matching with app ID
[snip, too much information]
DEBUG resources::utils::app > Associating process 3973296 with app "Resources" (ID: "net.nokyan.Resources") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3973304 with app "Resources" (ID: "net.nokyan.Resources") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3973305 with app "Resources" (ID: "net.nokyan.Resources") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3973309 with app "Resources" (ID: "net.nokyan.Resources") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3973310 with app "Resources" (ID: "net.nokyan.Resources") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3973337 with app "Resources" (ID: "net.nokyan.Resources") based on process cgroup matching with app ID
DEBUG resources::utils::app > Associating process 3973341 with app "Resources" (ID: "net.nokyan.Resources") based on match in KNOWN_EXECUTABLE_NAME_EXCEPTIONS
INFO resources::ui::window > A drive has been added (or turned visible): /sys/block/nvme0n1
INFO resources::ui::window > A network interface has been added (or turned visible): /sys/class/net/enp0s31f6
INFO resources::ui::window > A network interface has been added (or turned visible): /sys/class/net/wlp3s0
INFO resources::ui::window > A battery has been added: /sys/class/power_supply/BAT1
DEBUG resources::utils::settings > Setting uint graph-data-points to 60
DEBUG resources::utils::settings > Setting refresh-speed to Normal
DEBUG resources::ui::window::imp > Closing the application…
DEBUG resources::utils::settings > Setting int window-width to 1043
DEBUG resources::utils::settings > Setting int window-height to 818
DEBUG resources::utils::settings > Setting boolean is-maximized to false
Environment
Anything Else?
I wanted to make a Sysprof profiling capture of this, but was unable to make one with meaningful debug symbols to show function names, even with the .Debug flatpak package installed alongside the app.
GNOME System Monitor agrees with the observed measurement:
Hi, thanks for the issue. The part of Resources that uses the most CPU time is its companion process resources-process as visible in your GNOME System Monitor screenshot. resources-processes is spawned outside the Flatpak sandbox to gather process data. I will look into that, but can't promise anything in the near future. Using flamegraph (or Sysprof) for profiling resources-processes, most time (which I'm not sure is necessarily active CPU time or just waiting for I/O) seems to be spent on reading files, which makes sense as resources-processes heavily uses procfs to get process information.
Hello. I'm having a similar issue.
Resources is gradually consuming more and more RAM from my system time to time. After some time (hours) with the app open, it always appears with this high memory usage.
At the top you can see Resource displayed on Resource Apps List (lol). Bottom shows the Resource process on GNOME System Monitor.
Testing:
When restarted, Resources came back to consume only about 67-68 MB of memory. After ~10 minutes it is already consuming 100 MB.
System info
I can provide my system's info if needed. Just ask.
Resources version 1.7.1
@IguJl15 I think a memory leak should be a separate issue, because here this is about unexpectedly high CPU usage.
Correct, issue #45 is about memory usage. I can't reproduce the high memory usage anymore and I also don't know what could be causing it.
Hi, in the resources-processes-performance branch I've implemented a measure to reduce hammering procfs for GPU-related info. In my testing, this cuts resources-processes (i.e. the main culprit for Resources' CPU usage) about in half. Do you mind testing the branch?
Please do keep in mind to change the [profile.dev] section in the Cargo.toml file to have the same contents as the [profile.release] section to keep the comparison between this and the Flathub build fair.
Correct, issue #45 is about memory usage. I can't reproduce the high memory usage anymore and I also don't know what could be causing it.
Observations:
- Start: Upon launch, it uses about 77 MB. After 30 min it uses about 140 MB
- After 6 days: Usage grows to 555 MB.
- Comparison: The native OS Task Manager stays stable under similar conditions.
Impact: I have to restart the app manually to free up resources.
I really like the functionality and design of your app compared to the standard one, so I hope this can be fixed in future updates.