aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-12 19:07:10 +0100
committerDanilo M. <danix@danix.xyz>2026-11-12 19:07:10 +0100
commit53c4a434a8587a531c288e98875ab76c180d376a (patch)
treec194efd3ed824eb1f12aeac1f2dc364250897b8f /tests
parentcb2de728a3af8b35997e82796fcd45799b17ad47 (diff)
downloaddeck-it-53c4a434a8587a531c288e98875ab76c180d376a.tar.gz
deck-it-53c4a434a8587a531c288e98875ab76c180d376a.zip
feat(stats): show GPU usage on the dashboard chip
xe reports no busy percentage, but its DRM fdinfo carries per-engine cycle counters. The 2s fdinfo pass that sums VRAM now also sums drm-cycles-rcs/ccs per client, and gpu.util is the busier of render (games) and compute (local LLMs) between two passes; a sum could pass 100% with both running. The GPU chip now matches the CPU chip: usage on a trend, temperature on the small line. VRAM and fan move to keystone's performance page. Without usage the temperature keeps the big value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stats.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/test_stats.py b/tests/test_stats.py
index f45a0cd..0a16cbe 100644
--- a/tests/test_stats.py
+++ b/tests/test_stats.py
@@ -75,8 +75,10 @@ class Intel(unittest.TestCase):
import tempfile
root = Path(tempfile.mkdtemp())
rows = [
- ("100", "3", "drm-driver:\txe\ndrm-client-id:\t7\ndrm-resident-vram0:\t1024 MiB\n"),
- ("100", "4", "drm-driver:\txe\ndrm-client-id:\t7\ndrm-resident-vram0:\t1024 MiB\n"),
+ ("100", "3", "drm-driver:\txe\ndrm-client-id:\t7\ndrm-resident-vram0:\t1024 MiB\n"
+ "drm-cycles-rcs:\t30\ndrm-total-cycles-rcs:\t1000\n"),
+ ("100", "4", "drm-driver:\txe\ndrm-client-id:\t7\ndrm-resident-vram0:\t1024 MiB\n"
+ "drm-cycles-rcs:\t30\ndrm-total-cycles-rcs:\t1000\n"),
("200", "5", "drm-driver:\txe\ndrm-client-id:\t8\ndrm-resident-vram0:\t512 MiB\n"),
("300", "6", "drm-driver:\ti915\ndrm-client-id:\t9\ndrm-resident-vram0:\t999 MiB\n"),
]
@@ -84,7 +86,17 @@ class Intel(unittest.TestCase):
d = root / pid / "fdinfo"
d.mkdir(parents=True, exist_ok=True)
(d / fd).write_text(body)
- self.assertEqual(stats._intel_vram_used(root), (1024 + 512) * 1024 ** 2)
+ vram, busy, clock = stats._intel_fdinfo(root)
+ self.assertEqual(vram, (1024 + 512) * 1024 ** 2)
+ self.assertEqual((busy["rcs"], clock["rcs"]), (30, 1000))
+
+ def test_gpu_util_is_busiest_engine(self):
+ before = (0, {"rcs": 0, "ccs": 0}, {"rcs": 1000, "ccs": 1000})
+ after = (0, {"rcs": 200, "ccs": 900}, {"rcs": 2000, "ccs": 2000})
+ self.assertEqual(stats._gpu_util(before, after), 90)
+ self.assertIsNone(stats._gpu_util(None, after))
+ exited = (0, {"rcs": 0, "ccs": 0}, {"rcs": 3000, "ccs": 3000})
+ self.assertEqual(stats._gpu_util(after, exited), 0)
if __name__ == "__main__":