mirror of
https://github.com/torvalds/linux.git
synced 2026-11-28 09:22:27 +00:00
Add metric value validation test to check if metric values are with in correct value ranges. There are three types of tests included: 1) positive-value test checks if all the metrics collected are non-negative; 2) single-value test checks if the list of metrics have values in given value ranges; 3) relationship test checks if multiple metrics follow a given relationship, e.g. memory_bandwidth_read + memory_bandwidth_write = memory_bandwidth_total. Signed-off-by: Weilin Wang <[email protected]> Tested-by: Namhyung Kim <[email protected]> Cc: [email protected] Cc: Ian Rogers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Caleb Biggers <[email protected]> Cc: Perry Taylor <[email protected]> Cc: Samantha Alt <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
31 lines
816 B
Bash
Executable File
31 lines
816 B
Bash
Executable File
#!/bin/bash
|
|
# perf metrics value validation
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
if [ "x$PYTHON" == "x" ]
|
|
then
|
|
if which python3 > /dev/null
|
|
then
|
|
PYTHON=python3
|
|
else
|
|
echo Skipping test, python3 not detected please set environment variable PYTHON.
|
|
exit 2
|
|
fi
|
|
fi
|
|
|
|
grep -q GenuineIntel /proc/cpuinfo || { echo Skipping non-Intel; exit 2; }
|
|
|
|
pythonvalidator=$(dirname $0)/lib/perf_metric_validation.py
|
|
rulefile=$(dirname $0)/lib/perf_metric_validation_rules.json
|
|
tmpdir=$(mktemp -d /tmp/__perf_test.program.XXXXX)
|
|
workload="perf bench futex hash -r 2 -s"
|
|
|
|
# Add -debug, save data file and full rule file
|
|
echo "Launch python validation script $pythonvalidator"
|
|
echo "Output will be stored in: $tmpdir"
|
|
$PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}"
|
|
ret=$?
|
|
rm -rf $tmpdir
|
|
|
|
exit $ret
|
|
|