mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
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
This commit is contained in:
parent
6750ba4b64
commit
659663f0bc
@ -115,9 +115,13 @@ toggle respectively.
|
|||||||
|
|
||||||
perf script also supports higher level ways to dump instruction traces:
|
perf script also supports higher level ways to dump instruction traces:
|
||||||
|
|
||||||
|
perf script --insn-trace=disasm
|
||||||
|
|
||||||
|
or to use the xed disassembler, which requires installing the xed tool
|
||||||
|
(see XED below):
|
||||||
|
|
||||||
perf script --insn-trace --xed
|
perf script --insn-trace --xed
|
||||||
|
|
||||||
Dump all instructions. This requires installing the xed tool (see XED below)
|
|
||||||
Dumping all instructions in a long trace can be fairly slow. It is usually better
|
Dumping all instructions in a long trace can be fairly slow. It is usually better
|
||||||
to start with higher level decoding, like
|
to start with higher level decoding, like
|
||||||
|
|
||||||
@ -130,12 +134,12 @@ or
|
|||||||
and then select a time range of interest. The time range can then be examined
|
and then select a time range of interest. The time range can then be examined
|
||||||
in detail with
|
in detail with
|
||||||
|
|
||||||
perf script --time starttime,stoptime --insn-trace --xed
|
perf script --time starttime,stoptime --insn-trace=disasm
|
||||||
|
|
||||||
While examining the trace it's also useful to filter on specific CPUs using
|
While examining the trace it's also useful to filter on specific CPUs using
|
||||||
the -C option
|
the -C option
|
||||||
|
|
||||||
perf script --time starttime,stoptime --insn-trace --xed -C 1
|
perf script --time starttime,stoptime --insn-trace=disasm -C 1
|
||||||
|
|
||||||
Dump all instructions in time range on CPU 1.
|
Dump all instructions in time range on CPU 1.
|
||||||
|
|
||||||
@ -1306,7 +1310,7 @@ Without timestamps, --per-thread must be specified to distinguish threads.
|
|||||||
|
|
||||||
perf script can be used to provide an instruction trace
|
perf script can be used to provide an instruction trace
|
||||||
|
|
||||||
$ perf script --guestkallsyms $KALLSYMS --insn-trace --xed -F+ipc | grep -C10 vmresume | head -21
|
$ perf script --guestkallsyms $KALLSYMS --insn-trace=disasm -F+ipc | grep -C10 vmresume | head -21
|
||||||
CPU 0/KVM 1440 ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms]) movq 0x48(%rax), %r9
|
CPU 0/KVM 1440 ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms]) movq 0x48(%rax), %r9
|
||||||
CPU 0/KVM 1440 ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms]) movq 0x50(%rax), %r10
|
CPU 0/KVM 1440 ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms]) movq 0x50(%rax), %r10
|
||||||
CPU 0/KVM 1440 ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms]) movq 0x58(%rax), %r11
|
CPU 0/KVM 1440 ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms]) movq 0x58(%rax), %r11
|
||||||
@ -1407,7 +1411,7 @@ There were none.
|
|||||||
|
|
||||||
'perf script' can be used to provide an instruction trace showing timestamps
|
'perf script' can be used to provide an instruction trace showing timestamps
|
||||||
|
|
||||||
$ perf script -i perf.data.kvm --guestkallsyms $KALLSYMS --insn-trace --xed -F+ipc | grep -C10 vmresume | head -21
|
$ perf script -i perf.data.kvm --guestkallsyms $KALLSYMS --insn-trace=disasm -F+ipc | grep -C10 vmresume | head -21
|
||||||
CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms]) movq 0x48(%rax), %r9
|
CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133cdd __vmx_vcpu_run+0x3d ([kernel.kallsyms]) movq 0x48(%rax), %r9
|
||||||
CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms]) movq 0x50(%rax), %r10
|
CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133ce1 __vmx_vcpu_run+0x41 ([kernel.kallsyms]) movq 0x50(%rax), %r10
|
||||||
CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms]) movq 0x58(%rax), %r11
|
CPU 1/KVM 17006 [001] 11500.262865593: ffffffff82133ce5 __vmx_vcpu_run+0x45 ([kernel.kallsyms]) movq 0x58(%rax), %r11
|
||||||
|
@ -83,7 +83,7 @@ int res_sample_browse(struct res_sample *res_samples, int num_res,
|
|||||||
r->tid ? "--tid " : "",
|
r->tid ? "--tid " : "",
|
||||||
r->tid ? (sprintf(tidbuf, "%d", r->tid), tidbuf) : "",
|
r->tid ? (sprintf(tidbuf, "%d", r->tid), tidbuf) : "",
|
||||||
extra_format,
|
extra_format,
|
||||||
rstype == A_ASM ? "-F +insn --xed" :
|
rstype == A_ASM ? "-F +disasm" :
|
||||||
rstype == A_SOURCE ? "-F +srcline,+srccode" : "",
|
rstype == A_SOURCE ? "-F +srcline,+srccode" : "",
|
||||||
symbol_conf.inline_name ? "--inline" : "",
|
symbol_conf.inline_name ? "--inline" : "",
|
||||||
"--show-lost-events ",
|
"--show-lost-events ",
|
||||||
|
@ -107,7 +107,7 @@ static int list_scripts(char *script_name, bool *custom,
|
|||||||
if (evsel)
|
if (evsel)
|
||||||
attr_to_script(scriptc.extra_format, &evsel->core.attr);
|
attr_to_script(scriptc.extra_format, &evsel->core.attr);
|
||||||
add_script_option("Show individual samples", "", &scriptc);
|
add_script_option("Show individual samples", "", &scriptc);
|
||||||
add_script_option("Show individual samples with assembler", "-F +insn --xed",
|
add_script_option("Show individual samples with assembler", "-F +disasm",
|
||||||
&scriptc);
|
&scriptc);
|
||||||
add_script_option("Show individual samples with source", "-F +srcline,+srccode",
|
add_script_option("Show individual samples with source", "-F +srcline,+srccode",
|
||||||
&scriptc);
|
&scriptc);
|
||||||
|
Loading…
Reference in New Issue
Block a user