[PATCH v4 0/4] perf report/annotate: Support average IPC and IPC coverage for function

From: Jin Yao
Date: Thu Nov 29 2018 - 02:48:08 EST


Add supporting of displaying the average IPC and IPC coverage
percentage per function.

For example,

$ perf record -b ...
$ perf report -s symbol or
perf report -s symbol --stdio

Overhead Symbol IPC [IPC Coverage]
39.60% [.] __random 2.30 [ 54.8%]
18.02% [.] main 0.43 [ 54.3%]
14.21% [.] compute_flag 2.29 [100.0%]
14.16% [.] rand 0.36 [100.0%]
7.06% [.] __random_r 2.57 [ 70.5%]
6.85% [.] rand@plt 0.00 [ 0.0%]
...

$ perf annotate --stdio2

Percent IPC Cycle (Average IPC: 2.30, IPC Coverage: 54.8%)

Disassembly of section .text:

000000000003aac0 <random@@GLIBC_2.2.5>:
8.32 3.28 sub $0x18,%rsp
3.28 mov $0x1,%esi
3.28 xor %eax,%eax
3.28 cmpl $0x0,argp_program_version_hook@@GLIBC_2.2.5+0x1e0
11.57 3.28 1 â je 20
lock cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+0x8a0
â jne 29
â jmp 43
11.57 1.10 20: cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+0x8a0
...

v4:
---
Add a new patch "perf report: Documentation average IPC and IPC coverage"
to explain the new columns "IPC" and "IPC Coverage".

Other patches are not changed.

v3:
---
Remove the sortkey "ipc" from command-line. The columns "IPC"
and "[IPC Coverage]" are automatically enabled when "symbol"
is specified.

Patch "perf report: Display average IPC and IPC coverage per symbol"
is impacted.

v2:
---
1. Merge in Jiri's patch to support stdio mode

2. Add a new patch "perf annotate: Create a annotate2 flag
in struct symbol" which records if the symbol has been
annotated yet.

3. Minor update such as adding { } for multiline code in 'if'
condition.

Jin Yao (4):
perf annotate: Compute average IPC and IPC coverage per symbol
perf annotate: Create a annotate2 flag in struct symbol
perf report: Display average IPC and IPC coverage per symbol
perf report: Documentation average IPC and IPC coverage

tools/perf/Documentation/perf-report.txt | 8 +++++
tools/perf/builtin-report.c | 26 ++++++++++++--
tools/perf/util/annotate.c | 42 ++++++++++++++++++++--
tools/perf/util/annotate.h | 5 +++
tools/perf/util/hist.h | 1 +
tools/perf/util/sort.c | 61 ++++++++++++++++++++++++++++++++
tools/perf/util/sort.h | 2 ++
tools/perf/util/symbol.h | 1 +
8 files changed, 140 insertions(+), 6 deletions(-)

--
2.7.4