2009-05-26 11:17:18 +04:00
|
|
|
perf-report(1)
|
2009-05-30 14:38:51 +04:00
|
|
|
==============
|
2009-05-26 11:17:18 +04:00
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2009-05-27 11:33:18 +04:00
|
|
|
perf-report - Read perf.data (created by perf record) and display the profile
|
2009-05-26 11:17:18 +04:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
[verse]
|
|
|
|
'perf report' [-i <file> | --input=file]
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
This command displays the performance counter profile information recorded
|
2009-06-23 18:39:53 +04:00
|
|
|
via perf record.
|
2009-05-26 11:17:18 +04:00
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
-i::
|
|
|
|
--input=::
|
2011-12-07 13:02:54 +04:00
|
|
|
Input file name. (default: perf.data unless stdin is a fifo)
|
2010-12-01 04:57:17 +03:00
|
|
|
|
|
|
|
-v::
|
|
|
|
--verbose::
|
|
|
|
Be more verbose. (show symbol address, etc)
|
|
|
|
|
2009-07-01 02:01:20 +04:00
|
|
|
-d::
|
|
|
|
--dsos=::
|
|
|
|
Only consider symbols in these dsos. CSV that understands
|
|
|
|
file://filename entries.
|
2009-11-09 14:26:13 +03:00
|
|
|
-n::
|
|
|
|
--show-nr-samples::
|
2009-07-11 19:18:37 +04:00
|
|
|
Show the number of samples for each symbol
|
2010-12-01 04:57:17 +03:00
|
|
|
|
|
|
|
--showcpuutilization::
|
|
|
|
Show sample percentage for different cpu modes.
|
|
|
|
|
2009-11-09 14:26:13 +03:00
|
|
|
-T::
|
|
|
|
--threads::
|
2009-08-07 15:55:24 +04:00
|
|
|
Show per-thread event counters
|
2011-11-13 22:30:08 +04:00
|
|
|
-c::
|
2009-07-01 02:01:21 +04:00
|
|
|
--comms=::
|
|
|
|
Only consider symbols in these comms. CSV that understands
|
|
|
|
file://filename entries.
|
2009-07-01 02:01:22 +04:00
|
|
|
-S::
|
|
|
|
--symbols=::
|
|
|
|
Only consider these symbols. CSV that understands
|
|
|
|
file://filename entries.
|
2009-05-26 11:17:18 +04:00
|
|
|
|
2012-03-19 06:53:48 +04:00
|
|
|
--symbol-filter=::
|
|
|
|
Only show symbols that match (partially) with this filter.
|
|
|
|
|
2010-12-01 04:57:17 +03:00
|
|
|
-U::
|
|
|
|
--hide-unresolved::
|
|
|
|
Only display entries resolved to a symbol.
|
|
|
|
|
perf diff: Use perf_session__fprintf_hists just like 'perf record'
That means that almost everything you can do with 'perf report'
can be done with 'perf diff', for instance:
$ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2699
samples) ] $ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2687
samples) ] perf diff | head -8
9.02% +1.00% find libc-2.10.1.so [.] _IO_vfprintf_internal
2.91% -1.00% find [kernel] [k] __kmalloc
2.85% -1.00% find [kernel] [k] ext4_htree_store_dirent
1.99% -1.00% find [kernel] [k] _atomic_dec_and_lock
2.44% find [kernel] [k] half_md4_transform
$
So if you want to zoom into libc:
$ perf diff --dsos libc-2.10.1.so | head -8
37.34% find [.] _IO_vfprintf_internal
10.34% find [.] __GI_memmove
8.25% +2.00% find [.] _int_malloc
5.07% -1.00% find [.] __GI_mempcpy
7.62% +2.00% find [.] _int_free
$
And if there were multiple commands using libc, it is also
possible to aggregate them all by using --sort symbol:
$ perf diff --dsos libc-2.10.1.so --sort symbol | head -8
37.34% [.] _IO_vfprintf_internal
10.34% [.] __GI_memmove
8.25% +2.00% [.] _int_malloc
5.07% -1.00% [.] __GI_mempcpy
7.62% +2.00% [.] _int_free
$
The displacement column now is off by default, to use it:
perf diff -m --dsos libc-2.10.1.so --sort symbol | head -8
37.34% [.] _IO_vfprintf_internal
10.34% [.] __GI_memmove
8.25% +2.00% [.] _int_malloc
5.07% -1.00% +2 [.] __GI_mempcpy
7.62% +2.00% -1 [.] _int_free
$
Using -t/--field-separator can be used for scripting:
$ perf diff -t, -m --dsos libc-2.10.1.so --sort symbol | head -8
37.34, , ,[.] _IO_vfprintf_internal
10.34, , ,[.] __GI_memmove
8.25,+2.00%, ,[.] _int_malloc
5.07,-1.00%, +2,[.] __GI_mempcpy
7.62,+2.00%, -1,[.] _int_free
6.99,+1.00%, -1,[.] _IO_new_file_xsputn
1.89,-2.00%, +4,[.] __readdir64
$
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260978567-550-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-12-16 18:49:27 +03:00
|
|
|
-s::
|
|
|
|
--sort=::
|
2012-12-27 13:11:47 +04:00
|
|
|
Sort histogram entries by given key(s) - multiple keys can be specified
|
|
|
|
in CSV format. Following sort keys are available:
|
2013-01-24 19:10:29 +04:00
|
|
|
pid, comm, dso, symbol, parent, cpu, srcline, weight, local_weight.
|
2012-12-27 13:11:47 +04:00
|
|
|
|
|
|
|
Each key has following meaning:
|
|
|
|
|
|
|
|
- comm: command (name) of the task which can be read via /proc/<pid>/comm
|
|
|
|
- pid: command and tid of the task
|
|
|
|
- dso: name of library or module executed at the time of sample
|
|
|
|
- symbol: name of function executed at the time of sample
|
|
|
|
- parent: name of function matched to the parent regex filter. Unmatched
|
|
|
|
entries are displayed as "[other]".
|
|
|
|
- cpu: cpu number the task ran at the time of sample
|
|
|
|
- srcline: filename and line number executed at the time of sample. The
|
2013-09-20 18:40:41 +04:00
|
|
|
DWARF debugging info must be provided.
|
2012-12-27 13:11:47 +04:00
|
|
|
|
|
|
|
By default, comm, dso and symbol keys are used.
|
|
|
|
(i.e. --sort comm,dso,symbol)
|
|
|
|
|
|
|
|
If --branch-stack option is used, following sort keys are also
|
|
|
|
available:
|
|
|
|
dso_from, dso_to, symbol_from, symbol_to, mispredict.
|
|
|
|
|
|
|
|
- dso_from: name of library or module branched from
|
|
|
|
- dso_to: name of library or module branched to
|
|
|
|
- symbol_from: name of function branched from
|
|
|
|
- symbol_to: name of function branched to
|
|
|
|
- mispredict: "N" for predicted branch, "Y" for mispredicted branch
|
2013-09-20 18:40:41 +04:00
|
|
|
- in_tx: branch in TSX transaction
|
|
|
|
- abort: TSX transaction abort.
|
2012-12-27 13:11:47 +04:00
|
|
|
|
|
|
|
And default sort keys are changed to comm, dso_from, symbol_from, dso_to
|
|
|
|
and symbol_to, see '--branch-stack'.
|
perf diff: Use perf_session__fprintf_hists just like 'perf record'
That means that almost everything you can do with 'perf report'
can be done with 'perf diff', for instance:
$ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2699
samples) ] $ perf record -f find / > /dev/null
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.062 MB perf.data (~2687
samples) ] perf diff | head -8
9.02% +1.00% find libc-2.10.1.so [.] _IO_vfprintf_internal
2.91% -1.00% find [kernel] [k] __kmalloc
2.85% -1.00% find [kernel] [k] ext4_htree_store_dirent
1.99% -1.00% find [kernel] [k] _atomic_dec_and_lock
2.44% find [kernel] [k] half_md4_transform
$
So if you want to zoom into libc:
$ perf diff --dsos libc-2.10.1.so | head -8
37.34% find [.] _IO_vfprintf_internal
10.34% find [.] __GI_memmove
8.25% +2.00% find [.] _int_malloc
5.07% -1.00% find [.] __GI_mempcpy
7.62% +2.00% find [.] _int_free
$
And if there were multiple commands using libc, it is also
possible to aggregate them all by using --sort symbol:
$ perf diff --dsos libc-2.10.1.so --sort symbol | head -8
37.34% [.] _IO_vfprintf_internal
10.34% [.] __GI_memmove
8.25% +2.00% [.] _int_malloc
5.07% -1.00% [.] __GI_mempcpy
7.62% +2.00% [.] _int_free
$
The displacement column now is off by default, to use it:
perf diff -m --dsos libc-2.10.1.so --sort symbol | head -8
37.34% [.] _IO_vfprintf_internal
10.34% [.] __GI_memmove
8.25% +2.00% [.] _int_malloc
5.07% -1.00% +2 [.] __GI_mempcpy
7.62% +2.00% -1 [.] _int_free
$
Using -t/--field-separator can be used for scripting:
$ perf diff -t, -m --dsos libc-2.10.1.so --sort symbol | head -8
37.34, , ,[.] _IO_vfprintf_internal
10.34, , ,[.] __GI_memmove
8.25,+2.00%, ,[.] _int_malloc
5.07,-1.00%, +2,[.] __GI_mempcpy
7.62,+2.00%, -1,[.] _int_free
6.99,+1.00%, -1,[.] _IO_new_file_xsputn
1.89,-2.00%, +4,[.] __readdir64
$
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260978567-550-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-12-16 18:49:27 +03:00
|
|
|
|
2010-12-01 04:57:17 +03:00
|
|
|
-p::
|
|
|
|
--parent=<regex>::
|
2012-12-27 13:11:47 +04:00
|
|
|
A regex filter to identify parent. The parent is a caller of this
|
|
|
|
function and searched through the callchain, thus it requires callchain
|
|
|
|
information recorded. The pattern is in the exteneded regex format and
|
|
|
|
defaults to "\^sys_|^do_page_fault", see '--sort parent'.
|
2010-12-01 04:57:17 +03:00
|
|
|
|
|
|
|
-x::
|
|
|
|
--exclude-other::
|
|
|
|
Only display entries with parent-match.
|
|
|
|
|
2009-07-11 05:47:28 +04:00
|
|
|
-w::
|
2010-12-01 04:57:17 +03:00
|
|
|
--column-widths=<width[,width...]>::
|
2009-07-11 05:47:28 +04:00
|
|
|
Force each column width to the provided list, for large terminal
|
|
|
|
readability.
|
|
|
|
|
|
|
|
-t::
|
|
|
|
--field-separator=::
|
|
|
|
Use a special separator character and don't pad with spaces, replacing
|
2010-12-01 04:57:17 +03:00
|
|
|
all occurrences of this separator in symbol names (and other output)
|
2009-07-11 05:47:28 +04:00
|
|
|
with a '.' character, that thus it's the only non valid separator.
|
|
|
|
|
2010-12-01 04:57:17 +03:00
|
|
|
-D::
|
|
|
|
--dump-raw-trace::
|
|
|
|
Dump raw trace in ASCII.
|
|
|
|
|
2013-07-19 02:33:57 +04:00
|
|
|
-g [type,min[,limit],order[,key]]::
|
2009-08-31 05:32:03 +04:00
|
|
|
--call-graph::
|
2011-12-12 19:16:50 +04:00
|
|
|
Display call chains using type, min percent threshold, optional print
|
|
|
|
limit and order.
|
2009-08-31 05:32:03 +04:00
|
|
|
type can be either:
|
2010-12-01 04:57:17 +03:00
|
|
|
- flat: single column, linear exposure of call chains.
|
2009-08-31 05:32:03 +04:00
|
|
|
- graph: use a graph tree, displaying absolute overhead rates.
|
|
|
|
- fractal: like graph, but displays relative rates. Each branch of
|
|
|
|
the tree is considered as a new profiled object. +
|
2011-06-07 19:49:46 +04:00
|
|
|
|
|
|
|
order can be either:
|
|
|
|
- callee: callee based call graph.
|
|
|
|
- caller: inverted caller based call graph.
|
|
|
|
|
2013-07-19 02:33:57 +04:00
|
|
|
key can be:
|
|
|
|
- function: compare on functions
|
|
|
|
- address: compare on individual code addresses
|
|
|
|
|
|
|
|
Default: fractal,0.5,callee,function.
|
2011-06-07 19:49:46 +04:00
|
|
|
|
|
|
|
-G::
|
|
|
|
--inverted::
|
|
|
|
alias for inverted caller based call graph.
|
2009-08-31 05:32:03 +04:00
|
|
|
|
2012-12-07 09:48:05 +04:00
|
|
|
--ignore-callees=<regex>::
|
|
|
|
Ignore callees of the function(s) matching the given regex.
|
|
|
|
This has the effect of collecting the callers of each such
|
|
|
|
function into one place in the call-graph tree.
|
|
|
|
|
2010-12-01 04:57:17 +03:00
|
|
|
--pretty=<key>::
|
|
|
|
Pretty printing style. key: normal, raw
|
|
|
|
|
2010-08-21 17:38:16 +04:00
|
|
|
--stdio:: Use the stdio interface.
|
|
|
|
|
|
|
|
--tui:: Use the TUI interface, that is integrated with annotate and allows
|
|
|
|
zooming into DSOs or threads, among other features. Use of --tui
|
|
|
|
requires a tty, if one is not present, as when piping to other
|
|
|
|
commands, the stdio interface is used.
|
|
|
|
|
2012-03-19 22:13:29 +04:00
|
|
|
--gtk:: Use the GTK2 interface.
|
|
|
|
|
2010-12-01 04:57:17 +03:00
|
|
|
-k::
|
|
|
|
--vmlinux=<file>::
|
|
|
|
vmlinux pathname
|
|
|
|
|
2010-12-08 05:39:46 +03:00
|
|
|
--kallsyms=<file>::
|
|
|
|
kallsyms pathname
|
|
|
|
|
2010-12-01 04:57:17 +03:00
|
|
|
-m::
|
|
|
|
--modules::
|
|
|
|
Load module symbols. WARNING: This should only be used with -k and
|
|
|
|
a LIVE kernel.
|
|
|
|
|
|
|
|
-f::
|
|
|
|
--force::
|
|
|
|
Don't complain, do it.
|
|
|
|
|
2010-12-09 23:27:07 +03:00
|
|
|
--symfs=<directory>::
|
|
|
|
Look for files with symbols relative to this directory.
|
|
|
|
|
2011-11-13 22:30:08 +04:00
|
|
|
-C::
|
2011-07-04 15:57:50 +04:00
|
|
|
--cpu:: Only report samples for the list of CPUs provided. Multiple CPUs can
|
|
|
|
be provided as a comma-separated list with no space: 0,1. Ranges of
|
|
|
|
CPUs are specified with -: 0-2. Default is to report samples on all
|
|
|
|
CPUs.
|
|
|
|
|
2011-09-16 01:31:41 +04:00
|
|
|
-M::
|
|
|
|
--disassembler-style=:: Set disassembler style for objdump.
|
|
|
|
|
2011-10-06 19:48:31 +04:00
|
|
|
--source::
|
|
|
|
Interleave source code with assembly code. Enabled by default,
|
|
|
|
disable with --no-source.
|
|
|
|
|
|
|
|
--asm-raw::
|
|
|
|
Show raw instruction encoding of assembly instructions.
|
|
|
|
|
2011-10-05 23:10:06 +04:00
|
|
|
--show-total-period:: Show a column with the sum of periods.
|
|
|
|
|
perf tools: Make perf.data more self-descriptive (v8)
The goal of this patch is to include more information about the host
environment into the perf.data so it is more self-descriptive. Overtime,
profiles are captured on various machines and it becomes hard to track
what was recorded, on what machine and when.
This patch provides a way to solve this by extending the perf.data file
with basic information about the host machine. To add those extensions,
we leverage the feature bits capabilities of the perf.data format. The
change is backward compatible with existing perf.data files.
We define the following useful new extensions:
- HEADER_HOSTNAME: the hostname
- HEADER_OSRELEASE: the kernel release number
- HEADER_ARCH: the hw architecture
- HEADER_CPUDESC: generic CPU description
- HEADER_NRCPUS: number of online/avail cpus
- HEADER_CMDLINE: perf command line
- HEADER_VERSION: perf version
- HEADER_TOPOLOGY: cpu topology
- HEADER_EVENT_DESC: full event description (attrs)
- HEADER_CPUID: easy-to-parse low level CPU identication
The small granularity for the entries is to make it easier to extend
without breaking backward compatiblity. Many entries are provided as
ASCII strings.
Perf report/script have been modified to print the basic information as
easy-to-parse ASCII strings. Extended information about CPU and NUMA
topology may be requested with the -I option.
Thanks to David Ahern for reviewing and testing the many versions of
this patch.
$ perf report --stdio
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# ========
#
...
$ perf report --stdio -I
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# sibling cores : 0-3
# sibling threads : 0
# sibling threads : 1
# sibling threads : 2
# sibling threads : 3
# node0 meminfo : total = 8320608 kB, free = 7571024 kB
# node0 cpu list : 0-3
# ========
#
...
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20110930134040.GA5575@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
[ committer notes: Use --show-info in the tools as was in the docs, rename
perf_header_fprintf_info to perf_file_section__fprintf_info, fixup
conflict with f69b64f7 "perf: Support setting the disassembler style" ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-09-30 17:40:40 +04:00
|
|
|
-I::
|
|
|
|
--show-info::
|
|
|
|
Display extended information about the perf.data file. This adds
|
|
|
|
information which may be very large and thus may clutter the display.
|
|
|
|
It currently includes: cpu and numa topology of the host system.
|
|
|
|
|
perf report: Add support for taken branch sampling
This patch adds support for taken branch sampling, i.e, the
PERF_SAMPLE_BRANCH_STACK feature to perf report. In other
words, to display histograms based on taken branches rather
than executed instructions addresses.
The new option is called -b and it takes no argument. To
generate meaningful output, the perf.data must have been
obtained using perf record -b xxx ... where xxx is a branch
filter option.
The output shows symbols, modules, sorted by 'who branches
where' the most often. The percentages reported in the first
column refer to the total number of branches captured and
not the usual number of samples.
Here is a quick example.
Here branchy is simple test program which looks as follows:
void f2(void)
{}
void f3(void)
{}
void f1(unsigned long n)
{
if (n & 1UL)
f2();
else
f3();
}
int main(void)
{
unsigned long i;
for (i=0; i < N; i++)
f1(i);
return 0;
}
Here is the output captured on Nehalem, if we are
only interested in user level function calls.
$ perf record -b any_call,u -e cycles:u branchy
$ perf report -b --sort=symbol
52.34% [.] main [.] f1
24.04% [.] f1 [.] f3
23.60% [.] f1 [.] f2
0.01% [k] _IO_new_file_xsputn [k] _IO_file_overflow
0.01% [k] _IO_vfprintf_internal [k] _IO_new_file_xsputn
0.01% [k] _IO_vfprintf_internal [k] strchrnul
0.01% [k] __printf [k] _IO_vfprintf_internal
0.01% [k] main [k] __printf
About half (52%) of the call branches captured are from main()
-> f1(). The second half (24%+23%) is split in two equal shares
between f1() -> f2(), f1() ->f3(). The output is as expected
given the code.
It should be noted, that using -b in perf record does not
eliminate information in the perf.data file. Consequently, a
typical profile can also be obtained by perf report by simply
not using its -b option.
It is possible to sort on branch related columns:
- dso_from, symbol_from
- dso_to, symbol_to
- mispredict
Signed-off-by: Roberto Agostino Vitillo <ravitillo@lbl.gov>
Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: peterz@infradead.org
Cc: acme@redhat.com
Cc: robert.richter@amd.com
Cc: ming.m.lin@intel.com
Cc: andi@firstfloor.org
Cc: asharma@fb.com
Cc: vweaver1@eecs.utk.edu
Cc: khandual@linux.vnet.ibm.com
Cc: dsahern@gmail.com
Link: http://lkml.kernel.org/r/1328826068-11713-14-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2012-02-10 02:21:03 +04:00
|
|
|
-b::
|
|
|
|
--branch-stack::
|
|
|
|
Use the addresses of sampled taken branches instead of the instruction
|
|
|
|
address to build the histograms. To generate meaningful output, the
|
2012-03-09 02:47:47 +04:00
|
|
|
perf.data file must have been obtained using perf record -b or
|
|
|
|
perf record --branch-filter xxx where xxx is a branch filter option.
|
|
|
|
perf report is able to auto-detect whether a perf.data file contains
|
|
|
|
branch stacks and it will automatically switch to the branch view mode,
|
|
|
|
unless --no-branch-stack is used.
|
perf report: Add support for taken branch sampling
This patch adds support for taken branch sampling, i.e, the
PERF_SAMPLE_BRANCH_STACK feature to perf report. In other
words, to display histograms based on taken branches rather
than executed instructions addresses.
The new option is called -b and it takes no argument. To
generate meaningful output, the perf.data must have been
obtained using perf record -b xxx ... where xxx is a branch
filter option.
The output shows symbols, modules, sorted by 'who branches
where' the most often. The percentages reported in the first
column refer to the total number of branches captured and
not the usual number of samples.
Here is a quick example.
Here branchy is simple test program which looks as follows:
void f2(void)
{}
void f3(void)
{}
void f1(unsigned long n)
{
if (n & 1UL)
f2();
else
f3();
}
int main(void)
{
unsigned long i;
for (i=0; i < N; i++)
f1(i);
return 0;
}
Here is the output captured on Nehalem, if we are
only interested in user level function calls.
$ perf record -b any_call,u -e cycles:u branchy
$ perf report -b --sort=symbol
52.34% [.] main [.] f1
24.04% [.] f1 [.] f3
23.60% [.] f1 [.] f2
0.01% [k] _IO_new_file_xsputn [k] _IO_file_overflow
0.01% [k] _IO_vfprintf_internal [k] _IO_new_file_xsputn
0.01% [k] _IO_vfprintf_internal [k] strchrnul
0.01% [k] __printf [k] _IO_vfprintf_internal
0.01% [k] main [k] __printf
About half (52%) of the call branches captured are from main()
-> f1(). The second half (24%+23%) is split in two equal shares
between f1() -> f2(), f1() ->f3(). The output is as expected
given the code.
It should be noted, that using -b in perf record does not
eliminate information in the perf.data file. Consequently, a
typical profile can also be obtained by perf report by simply
not using its -b option.
It is possible to sort on branch related columns:
- dso_from, symbol_from
- dso_to, symbol_to
- mispredict
Signed-off-by: Roberto Agostino Vitillo <ravitillo@lbl.gov>
Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: peterz@infradead.org
Cc: acme@redhat.com
Cc: robert.richter@amd.com
Cc: ming.m.lin@intel.com
Cc: andi@firstfloor.org
Cc: asharma@fb.com
Cc: vweaver1@eecs.utk.edu
Cc: khandual@linux.vnet.ibm.com
Cc: dsahern@gmail.com
Link: http://lkml.kernel.org/r/1328826068-11713-14-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2012-02-10 02:21:03 +04:00
|
|
|
|
2012-09-04 14:32:30 +04:00
|
|
|
--objdump=<path>::
|
|
|
|
Path to objdump binary.
|
|
|
|
|
2013-01-22 13:09:45 +04:00
|
|
|
--group::
|
|
|
|
Show event group information together.
|
|
|
|
|
2013-03-25 13:18:18 +04:00
|
|
|
--demangle::
|
|
|
|
Demangle symbol names to human readable form. It's enabled by default,
|
|
|
|
disable with --no-demangle.
|
|
|
|
|
2013-05-14 06:09:04 +04:00
|
|
|
--percent-limit::
|
|
|
|
Do not show entries which have an overhead under that percent.
|
|
|
|
(Default: 0).
|
|
|
|
|
2009-05-26 11:17:18 +04:00
|
|
|
SEE ALSO
|
|
|
|
--------
|
2011-10-06 19:48:31 +04:00
|
|
|
linkperf:perf-stat[1], linkperf:perf-annotate[1]
|