summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVenkata Ramana Nayana <venkata.ramana.nayana@intel.com>2023-07-04 19:25:16 +0530
committerPriyanka Dandamudi <priyanka.dandamudi@intel.com>2023-10-04 07:30:39 +0530
commit43df1747605a8d8f4819daa293920407077f1df4 (patch)
tree30d3d84bd35be91334dd42f0109e99bab4952008 /lib
parenta4b4a33d8312e4e30ca23d26bbd1758e56540e1d (diff)
tests/xe/perf_pmu: Tests for the XE pmu interface
There are set of engine group busyness counters provided by HW which are exposed via PMU events. Adding a basic unit tests to read those counters. v2: Added idle condition checks while reading the counters. (Rahul) Cc: Janga Rahul Kumar <janga.rahul.kumar@intel.com> Signed-off-by: Venkata Ramana Nayana <venkata.ramana.nayana@intel.com> Reviewed-by: Janga Rahul Kumar <janga.rahul.kumar@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_perf.c36
-rw-r--r--lib/igt_perf.h5
2 files changed, 41 insertions, 0 deletions
diff --git a/lib/igt_perf.c b/lib/igt_perf.c
index ffe078adc..3866c6d77 100644
--- a/lib/igt_perf.c
+++ b/lib/igt_perf.c
@@ -69,6 +69,36 @@ const char *i915_perf_device(int i915, char *buf, int buflen)
return buf;
}
+const char *xe_perf_device(int xe, char *buf, int buflen)
+{
+ char *s;
+ char pref[] = "xe_";
+ int len = strlen(pref);
+
+
+ if (!buf || buflen < len)
+ return "xe";
+
+ memcpy(buf, pref, len);
+
+ if (!bus_address(xe, buf + len, buflen - len))
+ buf[len - 1] = '\0';
+
+ /* Convert all colons in the address to '_', thanks perf! */
+ for (s = buf; *s; s++)
+ if (*s == ':')
+ *s = '_';
+
+ return buf;
+}
+
+uint64_t xe_perf_type_id(int xe)
+{
+ char buf[80];
+
+ return igt_perf_type_id(xe_perf_device(xe, buf, sizeof(buf)));
+}
+
uint64_t i915_perf_type_id(int i915)
{
char buf[80];
@@ -147,6 +177,12 @@ int perf_igfx_open_group(uint64_t config, int group)
PERF_FORMAT_TOTAL_TIME_ENABLED | PERF_FORMAT_GROUP);
}
+int perf_xe_open(int xe, uint64_t config)
+{
+ return _perf_open(xe_perf_type_id(xe), config, -1,
+ PERF_FORMAT_TOTAL_TIME_ENABLED);
+}
+
int perf_i915_open(int i915, uint64_t config)
{
return _perf_open(i915_perf_type_id(i915), config, -1,
diff --git a/lib/igt_perf.h b/lib/igt_perf.h
index 4d86e31ae..3d9ba2917 100644
--- a/lib/igt_perf.h
+++ b/lib/igt_perf.h
@@ -61,10 +61,15 @@ int igt_perf_open_group(uint64_t type, uint64_t config, int group);
const char *i915_perf_device(int i915, char *buf, int buflen);
uint64_t i915_perf_type_id(int i915);
+const char *xe_perf_device(int xe, char *buf, int buflen);
+uint64_t xe_perf_type_id(int);
+
int perf_igfx_open(uint64_t config);
int perf_igfx_open_group(uint64_t config, int group);
int perf_i915_open(int i915, uint64_t config);
int perf_i915_open_group(int i915, uint64_t config, int group);
+int perf_xe_open(int xe, uint64_t config);
+
#endif /* I915_PERF_H */