44 lines · bash
1#!/bin/bash2# perf all metrics test3# SPDX-License-Identifier: GPL-2.04 5err=06for m in $(perf list --raw-dump metrics); do7 echo "Testing $m"8 result=$(perf stat -M "$m" true 2>&1)9 if [[ "$result" =~ ${m:0:50} ]] || [[ "$result" =~ "<not supported>" ]]10 then11 continue12 fi13 # Failed so try system wide.14 result=$(perf stat -M "$m" -a sleep 0.01 2>&1)15 if [[ "$result" =~ ${m:0:50} ]]16 then17 continue18 fi19 # Failed again, possibly the workload was too small so retry with something20 # longer.21 result=$(perf stat -M "$m" perf bench internals synthesize 2>&1)22 if [[ "$result" =~ ${m:0:50} ]]23 then24 continue25 fi26 echo "Metric '$m' not printed in:"27 echo "$result"28 if [[ "$err" != "1" ]]29 then30 err=231 if [[ "$result" =~ "FP_ARITH" || "$result" =~ "AMX" ]]32 then33 echo "Skip, not fail, for FP issues"34 elif [[ "$result" =~ "PMM" ]]35 then36 echo "Skip, not fail, for Optane memory issues"37 else38 err=139 fi40 fi41done42 43exit "$err"44