aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamhyung Kim <[email protected]>2024-10-15 23:23:59 -0700
committerNamhyung Kim <[email protected]>2024-10-22 09:55:08 -0700
commit36fae9f93e5f00eb3e410784ce99a4d7503aa12e (patch)
treec8c45511759be561d640e234048a21e22fa7d354
parent634d36f82517eb5c6a9b9ec7fe3ba19dbbcb7809 (diff)
perf test: Add precise_max subtest to the perf record shell test
It's a very simply test just to run with cycles:P and instructions:P events. Cc: Ravi Bangoria <[email protected]> Cc: James Clark <[email protected]> Cc: Atish Patra <[email protected]> Cc: Mingwei Zhang <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Palmer Dabbelt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
-rwxr-xr-xtools/perf/tests/shell/record.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index 3eee72242290..f0e79200b981 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -271,6 +271,30 @@ test_topdown_leader_sampling() {
echo "Topdown leader sampling test [Success]"
}
+test_precise_max() {
+ echo "precise_max attribute test"
+ if ! perf stat -e "cycles,instructions" true 2> /dev/null
+ then
+ echo "precise_max attribute [Skipped no hardware events]"
+ return
+ fi
+ # Just to make sure it doesn't fail
+ if ! perf record -o "${perfdata}" -e "cycles:P" true 2> /dev/null
+ then
+ echo "precise_max attribute [Failed cycles:P event]"
+ err=1
+ return
+ fi
+ # On AMD, cycles and instructions events are treated differently
+ if ! perf record -o "${perfdata}" -e "instructions:P" true 2> /dev/null
+ then
+ echo "precise_max attribute [Failed instructions:P event]"
+ err=1
+ return
+ fi
+ echo "precise_max attribute test [Success]"
+}
+
# raise the limit of file descriptors to minimum
if [[ $default_fd_limit -lt $min_fd_limit ]]; then
ulimit -Sn $min_fd_limit
@@ -284,6 +308,7 @@ test_branch_counter
test_cgroup
test_leader_sampling
test_topdown_leader_sampling
+test_precise_max
# restore the default value
ulimit -Sn $default_fd_limit