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

perf: script: prefer capstone to XED

Now perf can show assembly instructions with libcapstone for x86, and the
capstone is better in general.

Signed-off-by: Changbin Du <changbin.du@huawei.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: changbin.du@gmail.com
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240217074046.4100789-6-changbin.du@huawei.com

authored by

Changbin Du and committed by
Namhyung Kim
659663f0 6750ba4b

+11 -7
+9 -5
tools/perf/Documentation/perf-intel-pt.txt
··· 115 115 116 116 perf script also supports higher level ways to dump instruction traces: 117 117 118 + perf script --insn-trace=disasm 119 + 120 + or to use the xed disassembler, which requires installing the xed tool 121 + (see XED below): 122 + 118 123 perf script --insn-trace --xed 119 124 120 - Dump all instructions. This requires installing the xed tool (see XED below) 121 125 Dumping all instructions in a long trace can be fairly slow. It is usually better 122 126 to start with higher level decoding, like 123 127 ··· 134 130 and then select a time range of interest. The time range can then be examined 135 131 in detail with 136 132 137 - perf script --time starttime,stoptime --insn-trace --xed 133 + perf script --time starttime,stoptime --insn-trace=disasm 138 134 139 135 While examining the trace it's also useful to filter on specific CPUs using 140 136 the -C option 141 137 142 - perf script --time starttime,stoptime --insn-trace --xed -C 1 138 + perf script --time starttime,stoptime --insn-trace=disasm -C 1 143 139 144 140 Dump all instructions in time range on CPU 1. 145 141 ··· 1310 1306 1311 1307 perf script can be used to provide an instruction trace 1312 1308 1313 - $ perf script --guestkallsyms $KALLSYMS --insn-trace --xed -F+ipc | grep -C10 vmresume | head -21 1309 + $ perf script --guestkallsyms $KALLSYMS --insn-trace=disasm -F+ipc | grep -C10 vmresume | head -21 1314 1310 CPU 0/KVM 1440 ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms]) movq 0x48(%rax), %r9 1315 1311 CPU 0/KVM 1440 ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms]) movq 0x50(%rax), %r10 1316 1312 CPU 0/KVM 1440 ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms]) movq 0x58(%rax), %r11 ··· 1411 1407 1412 1408 'perf script' can be used to provide an instruction trace showing timestamps 1413 1409 1414 - $ perf script -i perf.data.kvm --guestkallsyms $KALLSYMS --insn-trace --xed -F+ipc | grep -C10 vmresume | head -21 1410 + $ perf script -i perf.data.kvm --guestkallsyms $KALLSYMS --insn-trace=disasm -F+ipc | grep -C10 vmresume | head -21 1415 1411 CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms]) movq 0x48(%rax), %r9 1416 1412 CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms]) movq 0x50(%rax), %r10 1417 1413 CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms]) movq 0x58(%rax), %r11
+1 -1
tools/perf/ui/browsers/res_sample.c
··· 83 83 r->tid ? "--tid " : "", 84 84 r->tid ? (sprintf(tidbuf, "%d", r->tid), tidbuf) : "", 85 85 extra_format, 86 - rstype == A_ASM ? "-F +insn --xed" : 86 + rstype == A_ASM ? "-F +disasm" : 87 87 rstype == A_SOURCE ? "-F +srcline,+srccode" : "", 88 88 symbol_conf.inline_name ? "--inline" : "", 89 89 "--show-lost-events ",
+1 -1
tools/perf/ui/browsers/scripts.c
··· 107 107 if (evsel) 108 108 attr_to_script(scriptc.extra_format, &evsel->core.attr); 109 109 add_script_option("Show individual samples", "", &scriptc); 110 - add_script_option("Show individual samples with assembler", "-F +insn --xed", 110 + add_script_option("Show individual samples with assembler", "-F +disasm", 111 111 &scriptc); 112 112 add_script_option("Show individual samples with source", "-F +srcline,+srccode", 113 113 &scriptc);