[PATCH i-g-t 1/3] lib/igt_perf: modify perf_events dir function for xe
Riana Tauro
riana.tauro at intel.com
Fri Dec 8 08:52:49 UTC 2023
modify igt_perf_events_dir so that it can be used
for xe. Also modify pmu_read test to use these changes.
Signed-off-by: Riana Tauro <riana.tauro at intel.com>
---
lib/igt_perf.c | 6 ++----
lib/igt_perf.h | 2 +-
tests/intel/perf_pmu.c | 3 ++-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/igt_perf.c b/lib/igt_perf.c
index 3866c6d77..5b7bef042 100644
--- a/lib/igt_perf.c
+++ b/lib/igt_perf.c
@@ -129,13 +129,11 @@ uint64_t igt_perf_type_id(const char *device)
return strtoull(buf, NULL, 0);
}
-int igt_perf_events_dir(int i915)
+int igt_perf_events_dir(const char *device)
{
- char buf[80];
char path[PATH_MAX];
- i915_perf_device(i915, buf, sizeof(buf));
- snprintf(path, sizeof(path), "/sys/bus/event_source/devices/%s/events", buf);
+ snprintf(path, sizeof(path), "/sys/bus/event_source/devices/%s/events", device);
return open(path, O_RDONLY);
}
diff --git a/lib/igt_perf.h b/lib/igt_perf.h
index 3d9ba2917..776cb36bb 100644
--- a/lib/igt_perf.h
+++ b/lib/igt_perf.h
@@ -54,7 +54,7 @@ perf_event_open(struct perf_event_attr *attr,
}
uint64_t igt_perf_type_id(const char *device);
-int igt_perf_events_dir(int i915);
+int igt_perf_events_dir(const char *device);
int igt_perf_open(uint64_t type, uint64_t config);
int igt_perf_open_group(uint64_t type, uint64_t config, int group);
diff --git a/tests/intel/perf_pmu.c b/tests/intel/perf_pmu.c
index c6e6a8b77..a95a43eef 100644
--- a/tests/intel/perf_pmu.c
+++ b/tests/intel/perf_pmu.c
@@ -2420,11 +2420,12 @@ static void test_unload(unsigned int num_engines)
static void pmu_read(int i915)
{
char val[128];
+ char buf[80];
int pmu_fd;
struct dirent *de;
DIR *dir;
- pmu_fd = igt_perf_events_dir(i915);
+ pmu_fd = igt_perf_events_dir(i915_perf_device(i915, buf, sizeof(buf)));
igt_require(pmu_fd >= 0);
dir = fdopendir(dup(pmu_fd));
--
2.40.0
More information about the igt-dev
mailing list