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

Configure Feed

Select the types of activity you want to include in your feed.

perf test: Test addr2line unwinding works with inline functions

Add a test that seeks to see inline functions correctly displayed in
'perf script' from the inlineloop workload.

Committer testing:

# perf test 'addr2line inline unwinding'
76: test addr2line inline unwinding : Ok
# perf test -vv 'addr2line inline unwinding'
76: test addr2line inline unwinding:
--- start ---
test child forked, pid 1508628
Inline unwinding verification test
[ perf record: Woken up 129 times to write data ]
[ perf record: Captured and wrote 32.282 MB /tmp/perf-test-inline-addr2line.L4Sz8QtADJ/perf.data (4014 samples) ]
Inline unwinding verification test [Success]
---- end(0) ----
76: test addr2line inline unwinding : Ok
#

Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Tony Jones <tonyj@suse.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
54a23bff abec4647

+47
+47
tools/perf/tests/shell/addr2line_inlines.sh
··· 1 + #!/bin/bash 2 + # test addr2line inline unwinding 3 + # SPDX-License-Identifier: GPL-2.0 4 + 5 + set -e 6 + 7 + err=0 8 + test_dir=$(mktemp -d /tmp/perf-test-inline-addr2line.XXXXXXXXXX) 9 + perf_data="${test_dir}/perf.data" 10 + perf_script_txt="${test_dir}/perf_script.txt" 11 + 12 + cleanup() { 13 + rm -rf "${test_dir}" 14 + trap - EXIT TERM INT 15 + } 16 + 17 + trap_cleanup() { 18 + echo "Unexpected signal in ${FUNCNAME[1]}" 19 + cleanup 20 + exit 1 21 + } 22 + trap trap_cleanup EXIT TERM INT 23 + 24 + test_inlinedloop() { 25 + echo "Inline unwinding verification test" 26 + # Record data. Currently only dwarf callchains support inlined functions. 27 + perf record --call-graph dwarf -e task-clock:u -o "${perf_data}" -- perf test -w inlineloop 1 28 + 29 + # Check output with inline (default) and srcline 30 + perf script -i "${perf_data}" --fields +srcline > "${perf_script_txt}" 31 + 32 + # Expect the leaf and middle functions to occur on lines in the 20s, with 33 + # the non-inlined parent function on a line in the 30s. 34 + if grep -q "inlineloop.c:2. (inlined)" "${perf_script_txt}" && 35 + grep -q "inlineloop.c:3.$" "${perf_script_txt}" 36 + then 37 + echo "Inline unwinding verification test [Success]" 38 + else 39 + echo "Inline unwinding verification test [Failed missing inlined functions]" 40 + err=1 41 + fi 42 + } 43 + 44 + test_inlinedloop 45 + 46 + cleanup 47 + exit $err