From fda4e7847bb5dc985404269c81400eead52b0181 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 12 Nov 2026 19:07:18 +0100 Subject: feat(perf): show GPU render and compute load xe exposes no busy percentage, but its DRM fdinfo carries per-engine cycle counters. vram.sh becomes gpu.sh: the same scan also sums drm-cycles-rcs/ccs per client and prints them with the GPU's cycle counter, and Perf.js turns two scans into a percentage per engine. The GPU card's headline is now the busier engine, with render (games) and compute (local LLMs) as bars, then VRAM, temperature and fan. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/perf/test_gpu.sh | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 desktop/modules/perf/test_gpu.sh (limited to 'desktop/modules/perf/test_gpu.sh') diff --git a/desktop/modules/perf/test_gpu.sh b/desktop/modules/perf/test_gpu.sh new file mode 100755 index 0000000..8467c74 --- /dev/null +++ b/desktop/modules/perf/test_gpu.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# +# Copyright (C) 2026 Danilo M. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# gpu.sh: VRAM and engine cycles summed once per xe client id, units +# honoured, other drivers ignored; nothing at all when no xe client is found. +set -e +dir=$(dirname "$0") +tmp=$(mktemp) +trap 'rm -f "$tmp"' EXIT + +printf '%s\n' \ + "/proc/1/fdinfo/7:drm-driver: xe" \ + "/proc/1/fdinfo/7:drm-client-id: 38" \ + "/proc/1/fdinfo/7:drm-resident-vram0: 1024 KiB" \ + "/proc/1/fdinfo/7:drm-cycles-rcs: 30" \ + "/proc/1/fdinfo/7:drm-total-cycles-rcs: 1000" \ + "/proc/1/fdinfo/10:drm-driver: xe" \ + "/proc/1/fdinfo/10:drm-client-id: 38" \ + "/proc/1/fdinfo/10:drm-resident-vram0: 1024 KiB" \ + "/proc/1/fdinfo/10:drm-cycles-rcs: 30" \ + "/proc/1/fdinfo/10:drm-total-cycles-rcs: 1000" \ + "/proc/2/fdinfo/5:drm-driver: xe" \ + "/proc/2/fdinfo/5:drm-client-id: 40" \ + "/proc/2/fdinfo/5:drm-resident-vram0: 2 MiB" \ + "/proc/2/fdinfo/5:drm-cycles-ccs: 7" \ + "/proc/2/fdinfo/5:drm-total-cycles-ccs: 900" \ + "/proc/3/fdinfo/4:drm-driver: amdgpu" \ + "/proc/3/fdinfo/4:drm-client-id: 1" \ + "/proc/3/fdinfo/4:drm-resident-vram0: 9 GiB" > "$tmp" +got=$(sh "$dir/gpu.sh" "$tmp") +[ "$got" = "$((1024 * 1024 + 2 * 1024 * 1024)) 30 1000 7 900" ] || { echo "gpu: got '$got'"; exit 1; } + +: > "$tmp" +got=$(sh "$dir/gpu.sh" "$tmp") +[ -z "$got" ] || { echo "empty: got '$got'"; exit 1; } +echo ok -- cgit v1.2.3