Skip to content

Add a new plugin to ksystemstats to make pressure data (from /proc/pressure) available for use in system monitor sensors

Adrian Edwards requested to merge helpfulheck/ksystemstats:procdata into master

Usecase: As a former macOS user turned KDE user, I am rather fond of macOS's approach to displaying memory use in terms of memory pressure (or the percentage of time that the system is waiting for something to happen, like memory or IO - at least as far as i understand it). So far I have resorted to using random perl scripts to augment the functionality of the (presumably now deprecated) ksysguard application, however, I would like to be able to view system pressure information inside the new system monitor application, rather than having to resort to using two different apps.

I initially searched for a way to do this as a third party plugin that users could download via the KDE store or something, but couldn't find much documentation on the process for doing that and I was eventually led to this repository.

Technical Summary/Design: Pressure Stall Information (i believe thats the formal name) has been available in the Linux kernel at /proc/pressure/memory, /proc/pressure/cpu and /proc/pressure/io since at least kernel 5.0.

As this is essentially my first contribution to KDE and had a somewhat hard time finding documentation, this plugin is based on the implementations of similar, existing plugins in the codebase, notably the osinfo plugin from which most of this plugins initial code structure was based.

plugins/disks/disks.cpp:325 also seems to provide some precedent for directly reading /proc files as a source of data (this feels somewhat janky to me, but I can't really explain why nor find a better way to get this information for this plugin, so this might just be an artifact of being a new contributor.

Testing and Environment: The bulk of development was initially done many months ago under QT5, but my recent attempts to pick this back up were done primarily in a VM running a very recent KDE neon development .iso. The code was switched over to depending on KF6/QT6 with no changes besides a simple 5->6 dependency swap in commit 1600accb.

Drawbacks: I am not aware of similar Pressure Stall Information being available in SUSE or BSD systems. As a Linux user, I don't really have a way to easily verify that this plugin won't break those systems, however that is the intention. If there is a way to put this entire plugin's folder and make configs behind a linux-only compile flag, that would be ideal.

Merge request reports