Re: [PATCH v3] perf annotate: Add itrace options support
From: Leo Yan
Date: Tue Jun 15 2021 - 00:06:00 EST
Hi Jihong,
Loop in Adrain to be aware this AUX trace change.
On Tue, Jun 15, 2021 at 10:40:36AM +0800, Yang Jihong wrote:
> The "auxtrace_info" and "auxtrace" functions are not set in "tool" member of
> "annotate". As a result, perf annotate does not support parsing itrace data.
>
> Before:
>
> # perf record -e arm_spe_0/branch_filter=1/ -a sleep 1
> [ perf record: Woken up 9 times to write data ]
> [ perf record: Captured and wrote 20.874 MB perf.data ]
> # perf annotate --stdio
> Error:
> The perf.data data has no samples!
>
> Solution:
> 1.Add itrace options in help,
> 2.Set hook functions of "auxtrace_info" and "auxtrace" in perf_tool.
>
> After:
>
> # perf record --all-user -e arm_spe_0/branch_filter=1/ ls
> Couldn't synthesize bpf events.
> perf.data
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.010 MB perf.data ]
> # perf annotate --stdio
> Percent | Source code & Disassembly of libc-2.28.so for branch-miss (1 samples, percent: local period)
> ------------------------------------------------------------------------------------------------------------
> :
> :
> :
> : Disassembly of section .text:
> :
> : 0000000000066180 <__getdelim@@GLIBC_2.17>:
> 0.00 : 66180: stp x29, x30, [sp, #-96]!
> 0.00 : 66184: cmp x0, #0x0
> 0.00 : 66188: ccmp x1, #0x0, #0x4, ne // ne = any
> 0.00 : 6618c: mov x29, sp
> 0.00 : 66190: stp x24, x25, [sp, #56]
> 0.00 : 66194: stp x26, x27, [sp, #72]
> 0.00 : 66198: str x28, [sp, #88]
> 0.00 : 6619c: b.eq 66450 <__getdelim@@GLIBC_2.17+0x2d0> // b.none
> 0.00 : 661a0: stp x22, x23, [x29, #40]
[...]
Nitpick: the above example is not typical for annotation, since it
doesn't show any C source code with samples. At my side, I tested this
patch and confirmed the patch works well with below commands:
# gcc -ggdb -O0 -o task_migration task_migration.c
# perf record -e cs_etm/@tmc_etr0/u --per-thread ./task_migration
# perf annotate --itrace=i1000 --stdio
The complete annotation result can be reviewed at [1].
Thus for this patch:
Tested-by: Leo Yan <leo.yan@xxxxxxxxxx>
[1] https://paste.ubuntu.com/p/pHz74MYRPJ/
[...]