[PATCH v1 0/2] perf annotate: add max/min cycles

From: Jin Yao
Date: Thu May 17 2018 - 02:07:54 EST


Currently perf has a feature to account cycles for LBRs

For example, on skylake,

perf record -b ...
perf report or
perf annotate

And then browsing the annotate browser gives average cycle counts
for program blocks.

For some analysis it would be useful if we could know not only
the average cycles but also the max and min cycles.

Now, for example, when press 'c', the annotate view is:

Percentâ IPC Cycle(max/min)
â
â
â Disassembly of section .text:
â
â 000000000003aab0 <random@@GLIBC_2.2.5>:
8.22 â3.92 sub $0x18,%rsp
â3.92 mov $0x1,%esi
â3.92 xor %eax,%eax
â3.92 cmpl $0x0,argp_program_version_hook@@G
â3.92 1(2/1) â je 20
â lock cmpxchg %esi,__abort_msg@@GLIBC_P
â â jne 29
â â jmp 43
â1.10 20: cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+
8.93 â1.10 1(5/1) â je 43

When press 'c' again, the annotate view is switched back:

Percentâ IPC Cycle
â
â
â Disassembly of section .text:
â
â 000000000003aab0 <random@@GLIBC_2.2.5>:
8.22 â3.92 sub $0x18,%rsp
â3.92 mov $0x1,%esi
â3.92 xor %eax,%eax
â3.92 cmpl $0x0,argp_program_version_hook@@GLIBC_2.2.5+0x
â3.92 1 â je 20
â lock cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+0x8a0
â â jne 29
â â jmp 43
â1.10 20: cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+0x8a0
8.93 â1.10 1 â je 43

Jin Yao (2):
perf annotate: Record the max/min cycles
perf annotate: Create hotkey 'c' to show max/min cycles

tools/perf/ui/browsers/annotate.c | 8 ++++++
tools/perf/util/annotate.c | 51 +++++++++++++++++++++++++++++++++------
tools/perf/util/annotate.h | 11 ++++++++-
3 files changed, 62 insertions(+), 8 deletions(-)

--
2.7.4