[PATCH i-g-t 2/8] tests/intel/xe_drm_fdinfo: Add helper to read utilization for all classes
Umesh Nerlige Ramappa
umesh.nerlige.ramappa at intel.com
Fri Jun 21 23:00:56 UTC 2024
Add a helper that captures utilization for all classes.
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
tests/intel/xe_drm_fdinfo.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index e624029b8..41409b2d2 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -39,6 +39,11 @@ IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption and engine u
#define BO_SIZE (65536)
+struct pceu_cycles {
+ uint64_t cycles;
+ uint64_t total_cycles;
+};
+
static const char *engine_map[] = {
"rcs",
"bcs",
@@ -46,6 +51,20 @@ static const char *engine_map[] = {
"vecs",
"ccs",
};
+static void read_engine_cycles(int xe, struct pceu_cycles *pceu)
+{
+ struct drm_client_fdinfo info = { };
+ int class;
+
+ igt_assert(pceu);
+ igt_assert(igt_parse_drm_fdinfo(xe, &info, engine_map,
+ ARRAY_SIZE(engine_map), NULL, 0));
+
+ xe_for_each_engine_class(class) {
+ pceu[class].cycles = info.cycles[class];
+ pceu[class].total_cycles = info.total_cycles[class];
+ }
+}
/* Subtests */
static void test_active(int fd, struct drm_xe_engine *engine)
{
--
2.34.1
More information about the igt-dev
mailing list