linux-stable/tools/perf
Andi Kleen b585ebdb59 perf script: Add --insn-trace for instruction decoding
Add a --insn-trace short hand option for decoding and disassembling
instruction streams for intel_pt. This automatically pipes the output
into the xed disassembler to generate disassembled instructions.  This
just makes this use model much nicer to use.

Before

  % perf record -e intel_pt// ...
  % perf script --itrace=i0ns --ns -F +insn,-event,-period | xed -F insn: -A -64
   swapper 0 [000] 17276.429606186: ffffffff81010486 pt_config ([kernel.kallsyms])    nopl  %eax, (%rax,%rax,1)
   swapper 0 [000] 17276.429606186: ffffffff8101048b pt_config ([kernel.kallsyms])    add $0x10, %rsp
   swapper 0 [000] 17276.429606186: ffffffff8101048f pt_config ([kernel.kallsyms])    popq  %rbx
   swapper 0 [000] 17276.429606186: ffffffff81010490 pt_config ([kernel.kallsyms])    popq  %rbp
   swapper 0 [000] 17276.429606186: ffffffff81010491 pt_config ([kernel.kallsyms])    popq  %r12
   swapper 0 [000] 17276.429606186: ffffffff81010493 pt_config ([kernel.kallsyms])    popq  %r13
   swapper 0 [000] 17276.429606186: ffffffff81010495 pt_config ([kernel.kallsyms])    popq  %r14
   swapper 0 [000] 17276.429606186: ffffffff81010497 pt_config ([kernel.kallsyms])    popq  %r15
   swapper 0 [000] 17276.429606186: ffffffff81010499 pt_config ([kernel.kallsyms])    retq
   swapper 0 [000] 17276.429606186: ffffffff8101063e pt_event_add ([kernel.kallsyms])         cmpl  $0x1, 0x1b0(%rbx)
   swapper 0 [000] 17276.429606186: ffffffff81010645 pt_event_add ([kernel.kallsyms])         mov $0xffffffea, %eax
   swapper 0 [000] 17276.429606186: ffffffff8101064a pt_event_add ([kernel.kallsyms])         mov $0x0, %edx
   swapper 0 [000] 17276.429606186: ffffffff8101064f pt_event_add ([kernel.kallsyms])         popq  %rbx
   swapper 0 [000] 17276.429606186: ffffffff81010650 pt_event_add ([kernel.kallsyms])         cmovnz %edx, %eax
   swapper 0 [000] 17276.429606186: ffffffff81010653 pt_event_add ([kernel.kallsyms])         jmp 0xffffffff81010635
   swapper 0 [000] 17276.429606186: ffffffff81010635 pt_event_add ([kernel.kallsyms])         retq
   swapper 0 [000] 17276.429606186: ffffffff8115e687 event_sched_in.isra.107 ([kernel.kallsyms])       test %eax, %eax

Now:

  % perf record -e intel_pt// ...
  % perf script --insn-trace --xed
  ... same output ...

XED needs to be installed with:

  $ git clone https://github.com/intelxed/mbuild.git mbuild
  $ git clone https://github.com/intelxed/xed
  $ cd xed
  $ ./mfile.py
  $ ./mfile.py examples
  $ sudo ./mfile.py --prefix=/usr/local install
  $ sudo cp obj/examples/xed /usr/local/bin
  $ xed | head -3
  ERROR: required argument(s) were missing
  Copyright (C) 2017, Intel Corporation. All rights reserved.
  XED version: [v10.0-328-g7d62c8c49b7b]
  $

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20180920180540.14039-2-andi@firstfloor.org
[ Fixed up whitespace damage, added the 'mfile.py examples + cp obj/examples/xed ... ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-10-24 15:29:50 -03:00
..
arch perf arm64: Fix generate system call table failed with /tmp mounted with noexec 2018-10-19 11:56:57 -03:00
bench tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy' 2018-07-30 12:36:51 -03:00
Documentation perf script: Add --insn-trace for instruction decoding 2018-10-24 15:29:50 -03:00
examples/bpf perf augmented_syscalls: Avoid optimization to pass older BPF validators 2018-09-03 15:29:53 -03:00
include/bpf perf bpf: Add syscall_exit() helper 2018-08-30 15:52:20 -03:00
jvmti perf tools: Fix compilation errors on gcc8 2018-07-11 09:39:57 -04:00
pmu-events Merge remote-tracking branch 'tip/perf/urgent' into perf/core 2018-10-18 11:13:01 -03:00
python perf python: Make twatch.py work with both python2 and python3 2018-02-19 12:28:08 -03:00
scripts perf scripts python: exported-sql-viewer.py: Add All branches report 2018-10-23 14:47:14 -03:00
tests perf test: S390 does not support watchpoints in test 22 2018-10-08 14:23:44 -03:00
trace perf trace beauty: Reorganize 'struct sockaddr *' beautifier 2018-08-30 15:52:20 -03:00
ui perf annotate: Add support to toggle percent type 2018-08-08 15:55:52 -03:00
util perf trace: Introduce per-event maximum number of events property 2018-10-22 14:27:12 -03:00
.gitignore perf tools: Add trace/beauty/generated/ into .gitignore 2018-02-05 13:58:02 -03:00
Build perf trace: Remove audit-libs dependency if syscall tables are present 2018-01-23 09:51:38 -03:00
builtin-annotate.c perf tools: Remove perf_tool from event_op2 2018-09-19 10:25:10 -03:00
builtin-bench.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-buildid-cache.c perf buildid-cache: Warn --purge-all failures 2018-05-15 10:32:16 -03:00
builtin-buildid-list.c Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
builtin-c2c.c perf c2c report: Fix crash for empty browser 2018-07-31 10:53:20 -03:00
builtin-config.c Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
builtin-data.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
builtin-diff.c perf hists: Clarify callchain disabling when available 2018-07-24 14:37:33 -03:00
builtin-evlist.c Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
builtin-ftrace.c perf ftrace: Append an EOL when write tracing files 2018-02-19 09:49:12 -03:00
builtin-help.c perf tools: Rename HAVE_SYSCALL_TABLE to HAVE_SYSCALL_TABLE_SUPPORT 2018-04-12 10:33:31 -03:00
builtin-inject.c perf tools: Report itrace options in help 2018-09-19 15:06:59 -03:00
builtin-kallsyms.c perf machine: Ditch find_kernel_function variants 2018-04-30 12:20:54 -03:00
builtin-kmem.c tools lib traceevent, perf tools: Rename 'enum pevent_flag' to 'enum tep_flag' 2018-08-13 15:22:18 -03:00
builtin-kvm.c perf tools: Ditch the symbol_conf.nr_events global 2018-06-04 10:28:52 -03:00
builtin-list.c Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
builtin-lock.c Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
builtin-mem.c perf mem: Allow all record/report options 2018-04-18 15:35:48 -03:00
builtin-probe.c perf tools: No need to check if the argument to __get() function is NULL 2018-06-04 10:28:50 -03:00
builtin-record.c perf record: Encode -k clockid frequency into Perf trace 2018-10-18 11:16:38 -03:00
builtin-report.c Merge remote-tracking branch 'tip/perf/urgent' into perf/core 2018-10-18 11:13:01 -03:00
builtin-sched.c perf sched: Use sched->show_callchain where appropriate 2018-06-05 10:09:54 -03:00
builtin-script.c perf script: Add --insn-trace for instruction decoding 2018-10-24 15:29:50 -03:00
builtin-stat.c perf stat: Poll for monitored tasks being alive 2018-10-22 12:37:52 -03:00
builtin-timechart.c perf thread: Make thread__find_symbol() return the symbol searched 2018-04-26 13:47:09 -03:00
builtin-top.c perf hists: Clarify callchain disabling when available 2018-07-24 14:37:33 -03:00
builtin-trace.c perf trace: Introduce per-event maximum number of events property 2018-10-22 14:27:12 -03:00
builtin-version.c perf version: Print status for syscall_table 2018-04-12 10:33:34 -03:00
builtin.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
check-headers.sh tools include: Adopt linux/bits.h 2018-10-08 14:23:43 -03:00
command-list.txt perf help: Add missing subcommand version 2018-09-19 14:53:36 -03:00
CREDITS
design.txt
Makefile perf tools: Disable parallelism for 'make clean' 2018-08-20 08:54:58 -03:00
Makefile.config perf tools: Fix use of alternatives to find JDIR 2018-10-16 12:06:47 -03:00
Makefile.perf Merge remote-tracking branch 'tip/perf/urgent' into perf/core 2018-10-18 11:13:01 -03:00
MANIFEST perf tools: Get all of tools/{arch,include}/ in the MANIFEST 2017-09-25 10:39:43 -03:00
perf-archive.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-completion.sh perf tools: Auto-complete for events with ':' 2017-12-27 12:16:00 -03:00
perf-read-vdso.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-sys.h Drop a bunch of metag references 2018-02-23 14:29:59 +00:00
perf-with-kcore.sh
perf.c perf tools: Remove dead quote.[ch] code 2018-06-04 10:28:50 -03:00
perf.h perf record: Encode -k clockid frequency into Perf trace 2018-10-18 11:16:38 -03:00