Skip to content

Commit b42c4df

Browse files
namhyungacmel
authored andcommitted
perf test: Add DWARF callchain conversion test
$ perf test -vv "DWARF callchain" 87: perf inject to convert DWARF callchains to regular ones: --- start --- test child forked, pid 1560328 recording data with DWARF callchain [ perf record: Woken up 4 times to write data ] [ perf record: Captured and wrote 0.908 MB /tmp/perf-test.nM3WoW (105 samples) ] convert DWARF callchain using perf inject compare the both result excluding inlined functions ---- end(0) ---- 87: perf inject to convert DWARF callchains to regular ones : Ok $ Reviewed-by: Ian Rogers <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Peter Zijlstra <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 92ea788 commit b42c4df

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
# perf inject to convert DWARF callchains to regular ones
3+
# SPDX-License-Identifier: GPL-2.0
4+
5+
if ! perf check feature -q dwarf; then
6+
echo "SKIP: DWARF support is not available"
7+
exit 2
8+
fi
9+
10+
TESTDATA=$(mktemp /tmp/perf-test.XXXXXX)
11+
12+
err=0
13+
14+
cleanup()
15+
{
16+
trap - EXIT TERM INT
17+
rm -f ${TESTDATA}*
18+
}
19+
20+
trap_cleanup()
21+
{
22+
cleanup
23+
exit 1
24+
}
25+
26+
trap trap_cleanup EXIT TERM INT
27+
28+
echo "recording data with DWARF callchain"
29+
perf record -F 999 --call-graph dwarf -o "${TESTDATA}" -- perf test -w noploop
30+
31+
echo "convert DWARF callchain using perf inject"
32+
perf inject -i "${TESTDATA}" --convert-callchain -o "${TESTDATA}.new"
33+
34+
perf report -i "${TESTDATA}" --no-children -q --percent-limit=1 > ${TESTDATA}.out
35+
perf report -i "${TESTDATA}.new" --no-children -q --percent-limit=1 > ${TESTDATA}.new.out
36+
37+
echo "compare the both result excluding inlined functions"
38+
if diff -u "${TESTDATA}.out" "${TESTDATA}.new.out" | grep "^- " | grep -qv "(inlined)"; then
39+
echo "Found some differences"
40+
diff -u "${TESTDATA}.out" "${TESTDATA}.new.out"
41+
err=1
42+
fi
43+
44+
cleanup
45+
exit $err

0 commit comments

Comments
 (0)