diff options
Diffstat (limited to 'tools/perf/tests/shell/record.sh')
-rwxr-xr-x | tools/perf/tests/shell/record.sh | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh index 0fc7a909ae9b..ba8d873d3ca7 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -231,7 +231,7 @@ test_cgroup() { test_leader_sampling() { echo "Basic leader sampling test" - if ! perf record -o "${perfdata}" -e "{instructions,instructions}:Su" -- \ + if ! perf record -o "${perfdata}" -e "{cycles,cycles}:Su" -- \ perf test -w brstack 2> /dev/null then echo "Leader sampling [Failed record]" @@ -243,15 +243,15 @@ test_leader_sampling() { while IFS= read -r line do # Check if the two instruction counts are equal in each record - instructions=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="instructions:") print $(i-1)}') - if [ $(($index%2)) -ne 0 ] && [ ${instructions}x != ${prev_instructions}x ] + cycles=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="cycles:") print $(i-1)}') + if [ $(($index%2)) -ne 0 ] && [ ${cycles}x != ${prev_cycles}x ] then - echo "Leader sampling [Failed inconsistent instructions count]" + echo "Leader sampling [Failed inconsistent cycles count]" err=1 return fi index=$(($index+1)) - prev_instructions=$instructions + prev_cycles=$cycles done < $script_output echo "Basic leader sampling test [Success]" } @@ -273,27 +273,42 @@ test_topdown_leader_sampling() { } test_precise_max() { + local -i skipped=0 + echo "precise_max attribute test" - if ! perf stat -e "cycles,instructions" true 2> /dev/null + # Just to make sure event cycles is supported for sampling + if perf record -o "${perfdata}" -e "cycles" true 2> /dev/null then - echo "precise_max attribute [Skipped no hardware events]" - return + 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 + else + echo "precise_max attribute [Skipped no cycles:P event]" + ((skipped+=1)) fi - # Just to make sure it doesn't fail - if ! perf record -o "${perfdata}" -e "cycles:P" true 2> /dev/null + # On s390 event instructions is not supported for perf record + if perf record -o "${perfdata}" -e "instructions" true 2> /dev/null then - echo "precise_max attribute [Failed cycles:P event]" - err=1 - return + # 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 + else + echo "precise_max attribute [Skipped no instructions:P event]" + ((skipped+=1)) fi - # On AMD, cycles and instructions events are treated differently - if ! perf record -o "${perfdata}" -e "instructions:P" true 2> /dev/null + if [ $skipped -eq 2 ] then - echo "precise_max attribute [Failed instructions:P event]" - err=1 - return + echo "precise_max attribute [Skipped no hardware events]" + else + echo "precise_max attribute test [Success]" fi - echo "precise_max attribute test [Success]" } # raise the limit of file descriptors to minimum |