stat_metrics_values.sh 1007 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # perf metrics value validation
  3. # SPDX-License-Identifier: GPL-2.0
  4. shelldir=$(dirname "$0")
  5. # shellcheck source=lib/setup_python.sh
  6. . "${shelldir}"/lib/setup_python.sh
  7. grep -q GenuineIntel /proc/cpuinfo || { echo Skipping non-Intel; exit 2; }
  8. pythonvalidator=$(dirname $0)/lib/perf_metric_validation.py
  9. rulefile=$(dirname $0)/lib/perf_metric_validation_rules.json
  10. tmpdir=$(mktemp -d /tmp/__perf_test.program.XXXXX)
  11. workload="perf bench futex hash -r 2 -s"
  12. # Add -debug, save data file and full rule file
  13. echo "Launch python validation script $pythonvalidator"
  14. echo "Output will be stored in: $tmpdir"
  15. for cputype in /sys/bus/event_source/devices/cpu_*; do
  16. cputype=$(basename "$cputype")
  17. echo "Testing metrics for: $cputype"
  18. $PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}" \
  19. -cputype "${cputype}"
  20. ret=$?
  21. rm -rf $tmpdir
  22. if [ $ret -ne 0 ]; then
  23. echo "Metric validation return with errors. Please check metrics reported with errors."
  24. fi
  25. done
  26. exit $ret