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

perf/test: Speed up test case perf annotate basic tests

perf test 70 takes a long time. One culprit is the output of command
perf annotate. Per default enabled are
- demangle symbol names
- interleave source code with assembly code.
Disable demangle of symbols and abort the annotation
after the first 250 lines.

This speeds up the test case considerable, for example
on s390:

Output before:
# time perf test 70
70: perf annotate basic tests : Ok
.....
real 2m7.467s
user 1m26.869s
sys 0m34.086s
#

Output after:
# time perf test 70
70: perf annotate basic tests : Ok

real 0m3.341s
user 0m1.606s
sys 0m0.362s
#

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: sumanthk@linux.ibm.com
Link: https://lore.kernel.org/r/20240917085706.249691-1-tmricht@linux.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Thomas Richter and committed by
Namhyung Kim
b38c49d8 4f23fc34

+5 -5
+5 -5
tools/perf/tests/shell/annotate.sh
··· 44 44 fi 45 45 46 46 # Generate the annotated output file 47 - perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}" 47 + perf annotate --no-demangle -i "${perfdata}" --stdio 2> /dev/null | head -250 > "${perfout}" 48 48 49 49 # check if it has the target symbol 50 50 if ! grep "${testsym}" "${perfout}" ··· 63 63 fi 64 64 65 65 # check again with a target symbol name 66 - if ! perf annotate -i "${perfdata}" "${testsym}" 2> /dev/null | \ 67 - grep -m 3 "${disasm_regex}" 66 + if ! perf annotate --no-demangle -i "${perfdata}" "${testsym}" 2> /dev/null | \ 67 + head -250 | grep -m 3 "${disasm_regex}" 68 68 then 69 69 echo "Basic annotate [Failed: missing disasm output when specifying the target symbol]" 70 70 err=1 ··· 72 72 fi 73 73 74 74 # check one more with external objdump tool (forced by --objdump option) 75 - if ! perf annotate -i "${perfdata}" --objdump=objdump 2> /dev/null | \ 76 - grep -m 3 "${disasm_regex}" 75 + if ! perf annotate --no-demangle -i "${perfdata}" --objdump=objdump 2> /dev/null | \ 76 + head -250 | grep -m 3 "${disasm_regex}" 77 77 then 78 78 echo "Basic annotate [Failed: missing disasm output from non default disassembler (using --objdump)]" 79 79 err=1