Skip to content

Commit 180fd0c

Browse files
james-c-linaroacmel
authored andcommitted
perf tests: Make leader sampling test work without branch event
Arm a57 only has speculative branch events so this test fails there. The test doesn't depend on branch instructions so change it to instructions which is pretty much guaranteed to be everywhere. The test_branch_counter() test above already tests for the existence of the branches event and skips if its not present. Reviewed-by: Ian Rogers <[email protected]> Signed-off-by: James Clark <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Dapeng Mi <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Veronika Molnarova <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 264708b commit 180fd0c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tools/perf/tests/shell/record.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ test_cgroup() {
231231

232232
test_leader_sampling() {
233233
echo "Basic leader sampling test"
234-
if ! perf record -o "${perfdata}" -e "{branches,branches}:Su" perf test -w brstack 2> /dev/null
234+
if ! perf record -o "${perfdata}" -e "{instructions,instructions}:Su" -- \
235+
perf test -w brstack 2> /dev/null
235236
then
236237
echo "Leader sampling [Failed record]"
237238
err=1
@@ -241,16 +242,16 @@ test_leader_sampling() {
241242
perf script -i "${perfdata}" > $script_output
242243
while IFS= read -r line
243244
do
244-
# Check if the two branches counts are equal in each record
245-
branches=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="branches:") print $(i-1)}')
246-
if [ $(($index%2)) -ne 0 ] && [ ${branches}x != ${prev_branches}x ]
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 ]
247248
then
248-
echo "Leader sampling [Failed inconsistent branches count]"
249+
echo "Leader sampling [Failed inconsistent instructions count]"
249250
err=1
250251
return
251252
fi
252253
index=$(($index+1))
253-
prev_branches=$branches
254+
prev_instructions=$instructions
254255
done < $script_output
255256
echo "Basic leader sampling test [Success]"
256257
}

0 commit comments

Comments
 (0)