bench: fix perf_stat_metric to handle :u event-name suffixes

perf stat appends user/kernel/hypervisor modifiers (:u/:k/:h) to event
names when paranoid >= 2, which is the documented configuration. Strip
that suffix before comparison so 'instructions' matches 'instructions:u'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
balanza
2026-06-20 14:21:05 +02:00
co-authored by Claude Opus 4.7
parent 3d79bd9ad0
commit fca1abfb18
+5 -1
View File
@@ -26,7 +26,11 @@ perf_stat_metric() {
awk -F',' -v ev="$event" '
# skip comment/header lines starting with #
/^#/ { next }
$3 == ev { print $1; found=1; exit }
{
e = $3
sub(/:[ukh]+$/, "", e)
if (e == ev) { print $1; found=1; exit }
}
END { if (!found) print "null" }
' "$csv"
}