Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Use cycles event in perf record test for leader_sampling

On s390 the event instructions can not be used for recording.
This event is only supported by perf stat.

Change the event from instructions to cycles in subtest
test_leader_sampling.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Suggested-by: James Clark <james.clark@linaro.org>
Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Link: https://lore.kernel.org/r/20250131102756.4185235-3-tmricht@linux.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Thomas Richter and committed by
Namhyung Kim
90d97674 85919943

+5 -5
+5 -5
tools/perf/tests/shell/record.sh
··· 231 231 232 232 test_leader_sampling() { 233 233 echo "Basic leader sampling test" 234 - if ! perf record -o "${perfdata}" -e "{instructions,instructions}:Su" -- \ 234 + if ! perf record -o "${perfdata}" -e "{cycles,cycles}:Su" -- \ 235 235 perf test -w brstack 2> /dev/null 236 236 then 237 237 echo "Leader sampling [Failed record]" ··· 243 243 while IFS= read -r line 244 244 do 245 245 # Check if the two instruction counts are equal in each record 246 - instructions=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="instructions:") print $(i-1)}') 247 - if [ $(($index%2)) -ne 0 ] && [ ${instructions}x != ${prev_instructions}x ] 246 + cycles=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="cycles:") print $(i-1)}') 247 + if [ $(($index%2)) -ne 0 ] && [ ${cycles}x != ${prev_cycles}x ] 248 248 then 249 - echo "Leader sampling [Failed inconsistent instructions count]" 249 + echo "Leader sampling [Failed inconsistent cycles count]" 250 250 err=1 251 251 return 252 252 fi 253 253 index=$(($index+1)) 254 - prev_instructions=$instructions 254 + prev_cycles=$cycles 255 255 done < $script_output 256 256 echo "Basic leader sampling test [Success]" 257 257 }