perf script: Add output of IPC ratio
Add field 'ipc' to display instructions-per-cycle.
Example:
perf record -e intel_pt/cyc/u ls
perf script --insn-trace --xed -F+ipc,-dso,-cpu,-tid
ls
2670177.
697113434:
7f0dfdbcd090 _start+0x0 mov %rsp, %rdi IPC: 0.00 (1/877)
ls
2670177.
697113434:
7f0dfdbcd093 _start+0x3 callq 0x7f0dfdbce030
ls
2670177.
697113434:
7f0dfdbce030 _dl_start+0x0 pushq %rbp
ls
2670177.
697113434:
7f0dfdbce031 _dl_start+0x1 mov %rsp, %rbp
ls
2670177.
697113434:
7f0dfdbce034 _dl_start+0x4 pushq %r15
ls
2670177.
697113434:
7f0dfdbce036 _dl_start+0x6 pushq %r14
ls
2670177.
697113434:
7f0dfdbce038 _dl_start+0x8 pushq %r13
ls
2670177.
697113434:
7f0dfdbce03a _dl_start+0xa pushq %r12
ls
2670177.
697113434:
7f0dfdbce03c _dl_start+0xc mov %rdi, %r12
ls
2670177.
697113434:
7f0dfdbce03f _dl_start+0xf pushq %rbx
ls
2670177.
697113434:
7f0dfdbce040 _dl_start+0x10 sub $0x38, %rsp
ls
2670177.
697113434:
7f0dfdbce044 _dl_start+0x14 rdtsc
ls
2670177.
697113434:
7f0dfdbce046 _dl_start+0x16 mov %eax, %eax
ls
2670177.
697113434:
7f0dfdbce048 _dl_start+0x18 shl $0x20, %rdx
ls
2670177.
697113434:
7f0dfdbce04c _dl_start+0x1c or %rax, %rdx
ls
2670177.
697114471:
7f0dfdbce04f _dl_start+0x1f movq 0x27e22(%rip), %rax IPC: 0.00 (15/1685)
ls
2670177.
697116177:
7f0dfdbce056 _dl_start+0x26 movq %rdx, 0x27683(%rip) IPC: 0.00 (1/881)
Note, the IPC values are low due to page faults at the beginning of
execution. The additional cycles are due to the time to enter the
kernel, not the actual kernel page fault handler.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190520113728.14389-9-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>