181.1. nvtop-3.3.2
GPU utilisation from DRM fdinfo — top for every vendor's GPU
| Version | 3.3.2, release 1 |
| Shelf | sysmon — Process, resource and system-information monitors |
| Phase | 42_graphics (Graphics Stack), 167 of 189 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://github.com/Syllo/nvtop |
| Build time | 0.1 SBU |
| Installed size | 252.7 KiB in 7 files |
| Recipe | ports/core/sysmon/nvtop/kpkgbuild |
About
nvtop is a top for GPUs: a terminal program that shows each graphics card’s load, memory and clock, and the processes using it. For AMD and Intel GPUs it reads per-process engine time from the DRM fdinfo files under /proc/<pid>/fdinfo, the same source kdos-energyd’s GPU column reads, so the two agree. The install puts upstream’s nvtop.desktop in place, and build.sh then writes over it with the recipe’s own entry, which opens nvtop in a terminal from the menu as GPU Monitor.
Why it is in KDOS
The comment above it in script/phases/42_graphics/packages.d/sysmon.txt:
The same drm-engine-* fdinfo source kdos-energyd's GPU column reads, so the two agree by construction. NVIDIA_SUPPORT=OFF: NVML is in a driver this distro cannot build.
Sources
nvtop-3.3.2.tar.gz(309.2 KiB)
sha25648a295f3b3a917cc851d1aa8b185c09fde3a1b1e741fc57d7fa96b3671271630
upstream: https://github.com/Syllo/nvtop/archive/refs/tags/3.3.2.tar.gz
archive copy: sources-4/sysmon--nvtop-3.3.2.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, ncurses, libdrm, eudev.
Required by: no port names it.
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/42_graphics/phase.env && kpkg install nvtop'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/sysmon/nvtop.
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/nvtop
echo '48a295f3b3a917cc851d1aa8b185c09fde3a1b1e741fc57d7fa96b3671271630 nvtop-3.3.2.tar.gz' | 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/nvtop
SRC=$SRC_ROOT/nvtop-3.3.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf nvtop-3.3.2.tar.gz -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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
mkdir -p build && cd build
cmake .. -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DNVIDIA_SUPPORT=OFF \
-DAMDGPU_SUPPORT=ON \
-DINTEL_SUPPORT=ON \
-DMSM_SUPPORT=OFF \
-DPANFROST_SUPPORT=OFF \
-DPANTHOR_SUPPORT=OFF \
-DASCEND_SUPPORT=OFF \
-DTPU_SUPPORT=OFF \
-DV3D_SUPPORT=OFF \
-DROCKCHIP_SUPPORT=OFF \
-DMETAX_SUPPORT=OFF \
-DENFLAME_SUPPORT=OFF \
-DUSE_LIBUDEV_OVER_LIBSYSTEMD=ON
ninja
DESTDIR=$PKG ninja install
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/nvtop.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=GPU Monitor
GenericName=GPU Monitor
Comment=GPU load, memory and processes
Exec=nvtop
Icon=video-display
Terminal=true
Categories=System;Monitor;
Keywords=gpu;nvidia;amd;intel;nvtop;
EOF
chmod 644 "$PKG/usr/share/applications/nvtop.desktop"
The switches, and why each is set:
Upstream turns most backends on by default for Linux, so each is named here, and the binary carries readers only for the drivers an x86-64 KDOS machine can have (x86-64 only).
-DNVIDIA_SUPPORT=OFF— The NVIDIA backend, which loads NVML from NVIDIA’s proprietary driver. That driver is not something this tree can build, so the backend would have nothing to load.-DAMDGPU_SUPPORT=ON— AMD GPUs through theamdgpukernel driver and libdrm.-DINTEL_SUPPORT=ON— Intel GPUs through thei915andxekernel drivers.-DMSM_SUPPORT=OFF,-DPANFROST_SUPPORT=OFF,-DPANTHOR_SUPPORT=OFF,-DV3D_SUPPORT=OFF— The Adreno (msm), Mali (panfrost,panthor) and Raspberry Pi (v3d) drivers, which exist only on Arm systems.-DROCKCHIP_SUPPORT=OFF— The Rockchip NPU reader, which upstream enables only on Arm Linux.-DASCEND_SUPPORT=OFF,-DTPU_SUPPORT=OFF,-DMETAX_SUPPORT=OFF,-DENFLAME_SUPPORT=OFF— Huawei Ascend NPUs (throughlibdcmi.sofrom the Ascend driver), Google TPUs (throughlibtpuinfo.so), MetaX GPUs (throughlibmxsml) and Enflame GCUs (throughlibefml). Each vendor library comes from a vendor driver stack that is not a port.-DUSE_LIBUDEV_OVER_LIBSYSTEMD=ON— Discover devices through libudev, which eudev provides, even if a libsystemd is found. KDOS has no systemd (principles); with the switch the build cannot pick up a stray libsystemd, and with neither library it fails, since the AMD and Intel backends need one of them.
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/nvtop, 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 nvtop-3.3.2-1.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/nvtop, and runs the triggers its paths call for.
Contents
Installed programs: nvtop.
Installed directories: /usr/share/licenses/nvtop.
Short descriptions
nvtop |
interactive GPU process viewer |