linux-stable/tools/perf/Documentation
Andi Kleen 48d02a1d5c perf script: Add 'brstackinsn' for branch stacks
Implement printing instruction sequences as hex dump for branch stacks.

This relies on the x86 instruction decoder used by the PT decoder to
find the lengths of instructions to dump them individually.

This is good enough for pattern matching.

This allows to study hot paths for individual samples, together with
branch misprediction and cycle count / IPC information if available (on
Skylake systems).

  % perf record -b ...
  % perf script -F brstackinsn
  ...
    read_hpet+67:
          ffffffff9905b843        insn: 74 ea                     # PRED
          ffffffff9905b82f        insn: 85 c9
          ffffffff9905b831        insn: 74 12
          ffffffff9905b833        insn: f3 90
          ffffffff9905b835        insn: 48 8b 0f
          ffffffff9905b838        insn: 48 89 ca
          ffffffff9905b83b        insn: 48 c1 ea 20
          ffffffff9905b83f        insn: 39 f2
          ffffffff9905b841        insn: 89 d0
          ffffffff9905b843        insn: 74 ea                     # PRED

Only works when no special branch filters are specified.

Occasionally the path does not reach up to the sample IP, as the LBRs
may be frozen before executing a final jump. In this case we print a
special message.

The instruction dumper piggy backs on the existing infrastructure from
the IP PT decoder.

An earlier iteration of this patch relied on a disassembler, but this
version only uses the existing instruction decoder.

Committer note:

Added hint about how to get suitable perf.data files for use with
'-F brstackinsm':

  $ perf record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.018 MB perf.data (8 samples) ]
  $
  $ perf script -F brstackinsn
  Display of branch stack assembler requested, but non all-branch filter set
  Hint: run 'perf record -b ...'
  $

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Link: http://lkml.kernel.org/r/20170223234634.583-1-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-03-16 09:24:35 -03:00
..
android.txt perf tools: Update android build documentation 2016-07-04 20:27:27 -03:00
asciidoc.conf
Build.txt perf build: Add build documentation 2015-02-12 17:53:00 -03:00
callchain-overhead-calculation.txt perf tools: Document --children option in more detail 2015-04-29 10:38:06 -03:00
examples.txt perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
intel-bts.txt perf tools: Add Intel BTS support 2015-08-21 11:34:10 -03:00
intel-pt.txt perf intel-pt: Update documentation about context switch events 2016-11-11 13:18:52 -03:00
itrace.txt perf tools: Add support for skipping itrace instructions 2016-03-30 11:14:09 -03:00
jit-interface.txt perf symbols: Add description of JIT interface 2012-08-13 14:55:02 -03:00
jitdump-specification.txt perf jit: Add jitdump format specification document 2016-10-24 11:07:41 -03:00
Makefile tools: Move utilities.mak from perf to tools/scripts/ 2016-03-18 13:57:20 -03:00
manpage-1.72.xsl
manpage-base.xsl
manpage-bold-literal.xsl
manpage-normal.xsl
manpage-suppress-sp.xsl
perf-annotate.txt perf annotate: Add -q/--quiet option 2017-02-20 11:47:18 -03:00
perf-archive.txt perf archive: Remove duplicated 'runs' in man page 2013-12-09 15:21:45 -03:00
perf-bench.txt perf bench mem: Rename 'routine' to 'function' 2015-10-19 16:10:25 -03:00
perf-buildid-cache.txt perf buildid-cache: Scan and import user SDT events to probe cache 2016-07-04 19:39:00 -03:00
perf-buildid-list.txt
perf-c2c.txt perf c2c report: Coalesce by default only by pid,iaddr 2017-01-20 16:52:56 -03:00
perf-config.txt perf diff: Add diff.compute config option 2017-02-13 14:29:37 -03:00
perf-data.txt perf data ctf: Add '--all' option for 'perf data convert' 2016-06-28 10:54:57 -03:00
perf-diff.txt perf diff: Add -q/--quiet option 2017-02-20 11:47:08 -03:00
perf-evlist.txt perf evlist: Add --trace-fields option to show trace fields 2016-01-08 14:23:02 -03:00
perf-ftrace.txt perf ftrace: Add support for -a and -C option 2017-03-03 19:07:17 -03:00
perf-help.txt
perf-inject.txt perf inject: Add jitdump mmap injection support 2016-02-05 09:46:45 -03:00
perf-kallsyms.txt perf kallsyms: Introduce tool to look for extended symbol information on the running kernel 2017-01-11 16:48:01 -03:00
perf-kmem.txt perf kmem: Add option to specify time window of interest 2016-12-01 13:03:02 -03:00
perf-kvm.txt perf tools: Configurable per thread proc map processing time out 2015-06-19 18:27:13 -03:00
perf-list.txt perf list: Support long jevents descriptions 2016-10-03 21:35:47 -03:00
perf-lock.txt perf lock: Account for lock average wait time 2013-10-09 11:24:01 -03:00
perf-mem.txt perf mem: Add --ldlat option 2016-06-15 10:35:27 -03:00
perf-probe.txt perf probe: Ignore vmlinux buildid if offline kernel is given 2016-09-01 09:44:14 -03:00
perf-record.txt perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info 2017-03-14 11:38:23 -03:00
perf-report.txt perf tools: Add 'cgroup_id' sort order keyword 2017-03-14 15:17:37 -03:00
perf-sched.txt perf sched timehist: Add --next option 2017-03-14 15:17:38 -03:00
perf-script-perl.txt perf Documentation: Fix typos in perf/Documentation 2014-10-15 17:39:02 -03:00
perf-script-python.txt perf Documentation: Fix typos in perf/Documentation 2014-10-15 17:39:02 -03:00
perf-script.txt perf script: Add 'brstackinsn' for branch stacks 2017-03-16 09:24:35 -03:00
perf-stat.txt perf stat: Add -a as default target 2017-02-17 17:31:10 -03:00
perf-test.txt perf test: Add -F/--dont-fork option 2016-06-30 18:27:45 -03:00
perf-timechart.txt perf timechart: Add more options to IO mode 2014-07-10 00:22:54 +02:00
perf-top.txt perf tools: Explicitly document that --children is enabled by default 2016-12-07 12:00:35 -03:00
perf-trace.txt perf trace: Allow specifying list of syscalls and events in -e/--expr/--event 2017-01-11 16:48:01 -03:00
perf.data-file-format.txt perf tools: Update documentation info about quipper 2016-09-29 11:16:44 -03:00
perf.txt perf tools: Handle -h and -v options 2015-10-05 16:36:18 -03:00
perfconfig.example perf config: Show default report configuration in example and docs 2016-09-01 09:44:13 -03:00
tips.txt scripts/spelling.txt: add "an user" pattern and fix typo instances 2017-02-27 18:43:46 -08:00