From 53c4a434a8587a531c288e98875ab76c180d376a Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 12 Nov 2026 19:07:10 +0100 Subject: 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 --- tests/test_stats.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'tests/test_stats.py') 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__": -- cgit v1.2.3