| 1 | |
| 2 | |
| 3 | |
| 4 |
|
| 5 | shelldir=$(dirname "$0")
|
| 6 | |
| 7 | . "${shelldir}"/lib/setup_python.sh
|
| 8 |
|
| 9 | grep -q GenuineIntel /proc/cpuinfo || { echo Skipping non-Intel; exit 2; }
|
| 10 |
|
| 11 | |
| 12 | if ! perf stat -a -e instructions sleep 0.01 >/dev/null 2>&1; then
|
| 13 | echo "Skipping: no permission to record system-wide events (-a)"
|
| 14 | exit 2
|
| 15 | fi
|
| 16 |
|
| 17 |
|
| 18 | pythonvalidator=$(dirname $0)/lib/perf_metric_validation.py
|
| 19 | rulefile=$(dirname $0)/lib/perf_metric_validation_rules.json
|
| 20 | tmpdir=$(mktemp -d /tmp/__perf_test.program.XXXXX)
|
| 21 | workload="perf bench futex hash -r 1 -s"
|
| 22 |
|
| 23 | |
| 24 | echo "Launch python validation script $pythonvalidator"
|
| 25 | echo "Output will be stored in: $tmpdir"
|
| 26 | for cputype in /sys/bus/event_source/devices/cpu_*; do
|
| 27 | cputype=$(basename "$cputype")
|
| 28 | echo "Testing metrics for: $cputype"
|
| 29 | $PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}" \
|
| 30 | -cputype "${cputype}"
|
| 31 | ret=$?
|
| 32 | rm -rf $tmpdir
|
| 33 | if [ $ret -ne 0 ]; then
|
| 34 | echo "Metric validation return with errors. Please check metrics reported with errors."
|
| 35 | fi
|
| 36 | done
|
| 37 | exit $ret
|
| 38 |
|