perf report: Dump LBR callstack data by -D jointly with thread stack
Make perf report -D command print captured LBR callstack chain when it is
collected together with raw thread stack data:
2752673087247083 0x5d10 [0x548]: PERF_RECORD_SAMPLE(IP, 0x4002): 5841/5841: 0x40121f period:
1543862 addr: 0
... FP chain: nr:0
... branch callstack: nr:3
..... 0:
00000000004011d0
..... 1:
00007f393c388411
..... 2:
0000000000401098
... user regs: mask 0xff0fff ABI 64-bit
.... AX 0x34e7
.... BX 0x7fff5f6dd3c0
.... CX 0xffffffff
.... DX 0x34e6
.... SI 0x7f393c5268d0
.... DI 0x0
.... BP 0x401260
.... SP 0x7fff5f6dd3c0
.... IP 0x40121f
.... FLAGS 0x29f
.... CS 0x33
.... SS 0x2b
.... R8 0x7f393c526800
.... R9 0x7f393c525da0
.... R10 0xfffffffffffff70a
.... R11 0x246
.... R12 0x401070
.... R13 0x7fff5f6ddcb0
.... R14 0x0
.... R15 0x0
... ustack: size 1024, offset 0x130
. data_src: 0x5080021
... thread: stack_test:5841
...... dso: /root/abudanko/stacks/stack_test
Committer testing:
# perf record -g --call-graph dwarf,1024 -j stack,u ls > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.042 MB perf.data (10 samples) ]
#
Before:
# perf report -D |& grep PERF_RECORD_SAMPLE -A28 | tail -29
67538909824483 0xa7a0 [0x560]: PERF_RECORD_SAMPLE(IP, 0x4002): 9721/9721: 0x7f441b2b1e20 period:
1376095 addr: 0
... FP chain: nr:0
... user regs: mask 0xff0fff ABI 64-bit
.... AX 0x7f441b2b1000
.... BX 0x7f441b55b970
.... CX 0x7fff6e2db218
.... DX 0x7fff6e2db218
.... SI 0x7fff6e2db208
.... DI 0x1
.... BP 0x1
.... SP 0x7fff6e2db178
.... IP 0x7f441b2b1e20
.... FLAGS 0x20a
.... CS 0x33
.... SS 0x2b
.... R8 0x1
.... R9 0x7f441b371c18
.... R10 0x7f441b5a5f10
.... R11 0x202
.... R12 0x7fff6e2db208
.... R13 0x7fff6e2db218
.... R14 0x7f441b5a7150
.... R15 0x0
... ustack: size 1024, offset 0x148
. data_src: 0x5080021
... thread: ls:9721
...... dso: /usr/lib64/libpthread-2.29.so
0xad00 [0x60]: event: 10
#
After:
# perf report -D |& grep PERF_RECORD_SAMPLE -A31 | tail -32
67538909824483 0xa7a0 [0x560]: PERF_RECORD_SAMPLE(IP, 0x4002): 9721/9721: 0x7f441b2b1e20 period:
1376095 addr: 0
... FP chain: nr:0
... branch callstack: nr:4
..... 0:
00007f441b2b1e20
..... 1:
00007f441b58af1a
..... 2:
00007f441b58b0e1
..... 3:
00007f441b57c145
... user regs: mask 0xff0fff ABI 64-bit
.... AX 0x7f441b2b1000
.... BX 0x7f441b55b970
.... CX 0x7fff6e2db218
.... DX 0x7fff6e2db218
.... SI 0x7fff6e2db208
.... DI 0x1
.... BP 0x1
.... SP 0x7fff6e2db178
.... IP 0x7f441b2b1e20
.... FLAGS 0x20a
.... CS 0x33
.... SS 0x2b
.... R8 0x1
.... R9 0x7f441b371c18
.... R10 0x7f441b5a5f10
.... R11 0x202
.... R12 0x7fff6e2db208
.... R13 0x7fff6e2db218
.... R14 0x7f441b5a7150
.... R15 0x0
... ustack: size 1024, offset 0x148
. data_src: 0x5080021
... thread: ls:9721
...... dso: /usr/lib64/libpthread-2.29.so
#
Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/aa82e5dd-def2-0ca8-a064-db9e2e8ad076@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>