summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDapeng Mi <dapeng1.mi@linux.intel.com>2026-06-24 17:33:16 +0800
committerNamhyung Kim <namhyung@kernel.org>2026-07-04 09:39:04 -0700
commitb3665131e7a63b3ed2d91015a6db97c5f65a5328 (patch)
treeb1ea38c1c21807dcacd0e28597c022f51cc98634
parent6744430f106b0e46d6318d44a99cb27b0ee937ae (diff)
downloadlinux-b3665131e7a63b3ed2d91015a6db97c5f65a5328.tar.gz
linux-b3665131e7a63b3ed2d91015a6db97c5f65a5328.zip
perf tests: Add auto counter reload (ACR) sampling test
Add auto counter reload sampling test to verify that the intended event records can be captured and the self-reloaded events won't generate any records. Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-rwxr-xr-xtools/perf/tests/shell/record.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index dd90fef2088b..625240809fce 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -403,6 +403,48 @@ test_callgraph() {
echo "Callgraph test [Success]"
}
+test_acr_sampling() {
+ events="{instructions/period=40000,acr_mask=0x2/u,cycles/period=20000,acr_mask=0x3/u}"
+ pebs_events="{instructions/period=40000,acr_mask=0x2/pu,cycles/period=20000,acr_mask=0x3/u}"
+ echo "Auto counter reload (ACR) sampling test"
+ if ! perf record -o "${perfdata}" -e "${events}" ${testprog} 2> /dev/null
+ then
+ echo "Auto counter reload sampling [Skipped not supported]"
+ return
+ fi
+ if ! perf script -i "${perfdata}" -F event | grep -q "instructions"
+ then
+ echo "Auto counter reload sampling [Failed missing instructions event]"
+ err=1
+ return
+ fi
+ if perf script -i "${perfdata}" -F event | grep -q "cycles"
+ then
+ echo "Auto counter reload sampling [Failed cycles event shouldn't be sampled]"
+ err=1
+ return
+ fi
+ if ! perf record -o "${perfdata}" -e "${pebs_events}" ${testprog} 2> /dev/null
+ then
+ echo "Auto counter reload PEBS sampling [Skipped not supported]"
+ echo "Auto counter reload sampling [Success]"
+ return
+ fi
+ if ! perf script -i "${perfdata}" -F event | grep -q "instructions"
+ then
+ echo "Auto counter reload PEBS sampling [Failed missing instructions event]"
+ err=1
+ return
+ fi
+ if perf script -i "${perfdata}" -F event | grep -q "cycles"
+ then
+ echo "Auto counter reload PEBS sampling [Failed cycles event shouldn't be sampled]"
+ err=1
+ return
+ fi
+ echo "Auto counter reload sampling [Success]"
+}
+
test_ratio_to_prev() {
echo "ratio-to-prev test"
if ! perf record -o /dev/null -e "{instructions, cycles/period=100000,ratio-to-prev=0.5/}" \
@@ -458,6 +500,7 @@ test_leader_sampling
test_topdown_leader_sampling
test_precise_max
test_callgraph
+test_acr_sampling
test_ratio_to_prev
# restore the default value