stat_all_pfm.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # perf all libpfm4 events test
  3. # SPDX-License-Identifier: GPL-2.0
  4. if perf version --build-options | grep HAVE_LIBPFM | grep -q OFF
  5. then
  6. echo "Skipping, no libpfm4 support"
  7. exit 2
  8. fi
  9. err=0
  10. for p in $(perf list --raw-dump pfm)
  11. do
  12. if echo "$p" | grep -q unc_
  13. then
  14. echo "Skipping uncore event '$p' that may require additional options."
  15. continue
  16. fi
  17. echo "Testing $p"
  18. result=$(perf stat --pfm-events "$p" true 2>&1)
  19. x=$?
  20. if echo "$result" | grep -q "failed to parse event $p : invalid or missing unit mask"
  21. then
  22. continue
  23. fi
  24. if test "$x" -ne "0"
  25. then
  26. echo "Unexpected exit code '$x'"
  27. err=1
  28. fi
  29. if ! echo "$result" | grep -q "$p" && ! echo "$result" | grep -q "<not supported>"
  30. then
  31. # We failed to see the event and it is supported. Possibly the workload was
  32. # too small so retry with something longer.
  33. result=$(perf stat --pfm-events "$p" perf bench internals synthesize 2>&1)
  34. x=$?
  35. if test "$x" -ne "0"
  36. then
  37. echo "Unexpected exit code '$x'"
  38. err=1
  39. fi
  40. if ! echo "$result" | grep -q "$p"
  41. then
  42. echo "Event '$p' not printed in:"
  43. echo "$result"
  44. err=1
  45. fi
  46. fi
  47. done
  48. exit "$err"