diff options
Diffstat (limited to 'tests/test_stats.py')
| -rw-r--r-- | tests/test_stats.py | 18 |
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__": |
