[RFC PATCH v2 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs
From: Ian Rogers
Date: Mon May 25 2026 - 19:23:18 EST
This patch updates tools/perf/tests/shell/stat_metrics_values.sh to run
the metrics value validation linter twice: once for the legacy path,
and once under the --new print flag using the newly introduced python
validator `-new` argument:
$PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir ... -new
This mathematically guarantees that calculated Intel PMU metric values
staged inside the decoupled streaming JSON callbacks are parsed and
validated cleanly against the formal rules engine.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
Assisted-by: Antigravity:gemini-3.5-flash
---
tools/perf/tests/shell/stat_metrics_values.sh | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/shell/stat_metrics_values.sh b/tools/perf/tests/shell/stat_metrics_values.sh
index 30566f0b5427..02c0bcf6e078 100755
--- a/tools/perf/tests/shell/stat_metrics_values.sh
+++ b/tools/perf/tests/shell/stat_metrics_values.sh
@@ -22,9 +22,20 @@ for cputype in /sys/bus/event_source/devices/cpu_*; do
$PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}" \
-cputype "${cputype}"
ret=$?
- rm -rf $tmpdir
if [ $ret -ne 0 ]; then
echo "Metric validation return with errors. Please check metrics reported with errors."
+ rm -rf $tmpdir
+ exit $ret
+ fi
+
+ echo "Testing metrics for: $cputype (New API)"
+ $PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}" \
+ -cputype "${cputype}" -new
+ ret=$?
+ rm -rf $tmpdir
+ if [ $ret -ne 0 ]; then
+ echo "Metric validation return with errors (New API). Please check metrics reported with errors."
+ exit $ret
fi
done
exit $ret
--
2.54.0.794.g4f17f83d09-goog