345.1. ksystemstats-6.8.2
Plasma's sensor daemon — CPU, memory, disks, network, GPUs, power and hardware sensors over D-Bus
| Version | 6.8.2, release 2 |
| Shelf | sysmon — Process, resource and system-information monitors |
| Phase | 50_desktop (Desktop), 9 of 92 in build order |
| Licence | GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL |
| Homepage | https://invent.kde.org/plasma/ksystemstats |
| Build time | 0.3 SBU |
| Installed size | 1.4 MiB in 21 files |
| Recipe | ports/core/sysmon/ksystemstats/kpkgbuild |
About
ksystemstats is the daemon behind Plasma’s system monitor widgets and System Monitor. It owns org.kde.ksystemstats1 on the session bus and serves sensors from plugins: CPU, memory, disks, network, power, pressure stall information, GPUs and the hardware sensors of lm-sensors. The sensor model it serves is libksysguard’s.
Why it is in KDOS
The comment above it in script/phases/50_desktop/packages.txt:
The sensor daemon every system-monitor widget and Plasma System Monitor read over D-Bus.
Sources
ksystemstats-6.8.2.tar.xz(173.4 KiB)
sha2562a71fa12b3dd8ad4a6c31feae253b1d1ed7fb0ddd44c8d27a32b63583f8b4889
upstream: https://download.kde.org/stable/plasma/6.8.2/ksystemstats-6.8.2.tar.xz
archive copy: sources-4/sysmon--ksystemstats-6.8.2.tar.xz
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, pkgconf, qt6-qtbase, kcoreaddons, kcrash, ki18n, kio, solid, libksysguard, networkmanager-qt, lm-sensors, libnl, eudev.
Required by (3): kde-plasma, ksystemstats-kdos, plasma-systemmonitor.
Patches
build.sh applies these; kpkg applies nothing by itself.
refresh-rate-loop.patch— Re-assert NetworkManager's statistics refresh rate only when it is not 500 msRefreshRateMs is one property of the NetworkManager device, shared by every client, and each session with a network sensor runs its own ksystemstats. The refreshRateMsChanged handler took every other change signal for a foreign write and set the rate again, so with two sessions logged in each instance answered the other's writes without end: an NM audit line per write, about 130 a second, and some 40% of a CPU spent in NetworkManager and the system bus. The handler tests the value instead: it records a rate other than UpdateRate as the one to restore on exit and sets UpdateRate again, and a rate already at UpdateRate, whichever instance wrote it, ends the exchange.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install ksystemstats'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/sysmon/ksystemstats.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/sysmon/ksystemstats
echo '2a71fa12b3dd8ad4a6c31feae253b1d1ed7fb0ddd44c8d27a32b63583f8b4889 ksystemstats-6.8.2.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/ksystemstats
SRC=$SRC_ROOT/ksystemstats-6.8.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ksystemstats-6.8.2.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/refresh-rate-loop.patch"
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-D KF_SKIP_PO_PROCESSING=ON \
-D CMAKE_REQUIRE_FIND_PACKAGE_UDev=ON \
-D CMAKE_DISABLE_FIND_PACKAGE_Libcap=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
rm -rf "$PKG/usr/lib/systemd"
The switches, and why each is set:
-D KF_SKIP_PO_PROCESSING=ON— Skips building the interface translations, which the package-wide English-only rule would remove anyway (see Size and language policy).-D CMAKE_REQUIRE_FIND_PACKAGE_UDev=ON— Make libudev a requirement. Upstream marks it only recommended and builds the GPU plugin only when it is found; without it there are no GPU sensors. The library comes from eudev.-D CMAKE_DISABLE_FIND_PACKAGE_Libcap=ON— Nosetcapstep at install. Found, libcap makes the install runsetcap CAP_PERFMON=+eponksystemstats_intel_helperandksystemstats_xe_helper; kpkg’s package archive does not keep file capabilities, so the step would set a capability no installed copy carries.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/ksystemstats, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf ksystemstats-6.8.2-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/ksystemstats, and runs the triggers its paths call for.
Contents
Installed programs: kstatsviewer, ksystemstats.
Installed directories: /usr/share/licenses/ksystemstats.
Notes
The Intel GPU helpers read the kernel’s performance counters for the engine-busy sensors. Without CAP_PERFMON they can do so only where kernel.perf_event_paranoid allows an unprivileged user, so on a default kernel the Intel and Xe GPU usage sensors read nothing while temperature, memory and frequency still work. The Xe helper is built when the kernel headers provide drm/xe_drm.h.
Network sensors come from networkmanager-qt (WITH_NM, on by default on Linux), and socket counts from libnl’s sock_diag.
The daemon is started by D-Bus activation from /usr/share/dbus-1/services/org.kde.ksystemstats1.service, whose Exec= line names /usr/bin/ksystemstats. The install also puts a systemd user unit, plasma-ksystemstats.service, under /usr/lib/systemd; build.sh removes the directory, since KDOS has no systemd (see No systemd). The activation file’s SystemdService= line is then unused and the bus runs the Exec= line.
refresh-rate-loop.patch keeps two sessions’ network plugins from setting NetworkManager’s statistics refresh rate back and forth for as long as both are logged in. The patch is to be offered upstream.