stat_all_metrics.sh 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # perf all metrics test
  3. # SPDX-License-Identifier: GPL-2.0
  4. err=0
  5. for m in $(perf list --raw-dump metrics); do
  6. echo "Testing $m"
  7. result=$(perf stat -M "$m" true 2>&1)
  8. if [[ "$result" =~ ${m:0:50} ]] || [[ "$result" =~ "<not supported>" ]]
  9. then
  10. continue
  11. fi
  12. # Failed so try system wide.
  13. result=$(perf stat -M "$m" -a sleep 0.01 2>&1)
  14. if [[ "$result" =~ ${m:0:50} ]]
  15. then
  16. continue
  17. fi
  18. # Failed again, possibly the workload was too small so retry with something
  19. # longer.
  20. result=$(perf stat -M "$m" perf bench internals synthesize 2>&1)
  21. if [[ "$result" =~ ${m:0:50} ]]
  22. then
  23. continue
  24. fi
  25. echo "Metric '$m' not printed in:"
  26. echo "$result"
  27. if [[ "$err" != "1" ]]
  28. then
  29. err=2
  30. if [[ "$result" =~ "FP_ARITH" || "$result" =~ "AMX" ]]
  31. then
  32. echo "Skip, not fail, for FP issues"
  33. elif [[ "$result" =~ "PMM" ]]
  34. then
  35. echo "Skip, not fail, for Optane memory issues"
  36. else
  37. err=1
  38. fi
  39. fi
  40. done
  41. exit "$err"