24 lines · bash
1#!/bin/sh2# perf all PMU test3# SPDX-License-Identifier: GPL-2.04 5set -e6 7# Test all PMU events; however exclude parameterized ones (name contains '?')8for p in $(perf list --raw-dump pmu | sed 's/[[:graph:]]\+?[[:graph:]]\+[[:space:]]//g'); do9 echo "Testing $p"10 result=$(perf stat -e "$p" true 2>&1)11 if ! echo "$result" | grep -q "$p" && ! echo "$result" | grep -q "<not supported>" ; then12 # We failed to see the event and it is supported. Possibly the workload was13 # too small so retry with something longer.14 result=$(perf stat -e "$p" perf bench internals synthesize 2>&1)15 if ! echo "$result" | grep -q "$p" ; then16 echo "Event '$p' not printed in:"17 echo "$result"18 exit 119 fi20 fi21done22 23exit 024