Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 # perf all metrics test
0003 # SPDX-License-Identifier: GPL-2.0
0004 
0005 err=0
0006 for m in $(perf list --raw-dump metrics); do
0007   echo "Testing $m"
0008   result=$(perf stat -M "$m" true 2>&1)
0009   if [[ "$result" =~ "${m:0:50}" ]] || [[ "$result" =~ "<not supported>" ]]
0010   then
0011     continue
0012   fi
0013   # Failed so try system wide.
0014   result=$(perf stat -M "$m" -a true 2>&1)
0015   if [[ "$result" =~ "${m:0:50}" ]]
0016   then
0017     continue
0018   fi
0019   # Failed again, possibly the workload was too small so retry with something
0020   # longer.
0021   result=$(perf stat -M "$m" perf bench internals synthesize 2>&1)
0022   if [[ "$result" =~ "${m:0:50}" ]]
0023   then
0024     continue
0025   fi
0026   echo "Metric '$m' not printed in:"
0027   echo "$result"
0028   if [[ "$err" != "1" ]]
0029   then
0030     err=2
0031     if [[ "$result" =~ "FP_ARITH" || "$result" =~ "AMX" ]]
0032     then
0033       echo "Skip, not fail, for FP issues"
0034     elif [[ "$result" =~ "PMM" ]]
0035     then
0036       echo "Skip, not fail, for Optane memory issues"
0037     else
0038       err=1
0039     fi
0040   fi
0041 done
0042 
0043 exit "$err"