perf test: Restrict uniquifying test to machines with 'uncore_imc'

The test would fail if target machine does not have 'uncore_imc'
devices.

Since event uniquifying behavior is similar among different
architectures, we are restricting the test to only run on machines with
`uncore_imc` devices.

Suggested-by: Ian Rogers <[email protected]>
Signed-off-by: Chun-Tse Shao <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Skip the test, i.e. return 2, instead of returning 0 as if the test had succeed ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
Chun-Tse Shao authored and Arnaldo Carvalho de Melo committed 2025-06-16 14:05:10 -03:00
1 parent 44a5ab7a79
commit 070b315333
1 file changed
+10 -2
@@ -9,7 +9,8 @@ perf_tool=perf
err=0
test_event_uniquifying() {
# We use `clockticks` to verify the uniquify behavior.
# We use `clockticks` in `uncore_imc` to verify the uniquify behavior.
pmu="uncore_imc"
event="clockticks"
# If the `-A` option is added, the event should be uniquified.
@@ -43,11 +44,18 @@ test_event_uniquifying() {
echo "stat event uniquifying test"
uniquified_event_array=()
# Skip if the machine does not have `uncore_imc` device.
if ! ${perf_tool} list pmu | grep -q ${pmu}; then
echo "Target does not support PMU ${pmu} [Skipped]"
err=2
return
fi
# Check how many uniquified events.
while IFS= read -r line; do
uniquified_event=$(echo "$line" | awk '{print $1}')
uniquified_event_array+=("${uniquified_event}")
done < <(${perf_tool} list -v ${event} | grep "\[Kernel PMU event\]")
done < <(${perf_tool} list -v ${event} | grep ${pmu})
perf_command="${perf_tool} stat -e $event -A -o ${stat_output} -- true"
$perf_command