[PATCH v3 14/14] perf stat: Extend PMU metrics value linter to validate --new outputs
From: Ian Rogers
Date: Thu Jul 16 2026 - 00:35:02 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
Acked-by: Chun-Tse Shao <ctshao@xxxxxxxxxx>
---
tools/perf/tests/shell/stat_metrics_values.sh | 22 ++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/shell/stat_metrics_values.sh b/tools/perf/tests/shell/stat_metrics_values.sh
index 86c5c7f70933..3f545e88b69f 100755
--- a/tools/perf/tests/shell/stat_metrics_values.sh
+++ b/tools/perf/tests/shell/stat_metrics_values.sh
@@ -26,13 +26,29 @@ echo "Output will be stored in: $tmpdir"
for cputype in /sys/bus/event_source/devices/cpu_*; do
cputype=$(basename "$cputype")
echo "Testing metrics for: $cputype"
- $PYTHON $pythonvalidator -rule $rulefile -output_dir $tmpdir -wl "${workload}" \
+ mkdir -p "$tmpdir/legacy"
+ $PYTHON $pythonvalidator -rule $rulefile -output_dir "$tmpdir/legacy" -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."
+ echo "Metric validation return with errors. " \
+ "Please check metrics reported with errors in: " \
+ "$tmpdir/legacy"
+ exit $ret
+ fi
+
+ echo "Testing metrics for: $cputype (New API)"
+ mkdir -p "$tmpdir/new"
+ $PYTHON $pythonvalidator -rule $rulefile -output_dir "$tmpdir/new" -wl "${workload}" \
+ -cputype "${cputype}" -new
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "Metric validation return with errors (New API). " \
+ "Please check metrics reported with errors in: " \
+ "$tmpdir/new"
+ exit $ret
fi
done
+rm -rf "$tmpdir"
exit $ret
--
2.55.0.141.g00534a21ce-goog