Thread (5 messages) 5 messages, 3 authors, 2021-06-15

Re: [PATCH v3] perf annotate: Add itrace options support

From: Yang Jihong <hidden>
Date: 2021-06-15 09:28:50
Also in: lkml

Hello, Adrain,

On 2021/6/15 16:22, Adrian Hunter wrote:
On 15/06/21 5:40 am, Yang Jihong wrote:
quoted
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]

Signed-off-by: Yang Jihong <redacted>
---

Changes since v2:
  - Updating tools/perf/Documentation/perf-annotate.txt.
  - Add test result to commit message.

Changes since v1:
  - Adjust spaces to maintain alignment in "tool".

  tools/perf/Documentation/perf-annotate.txt |  7 +++++++
  tools/perf/builtin-annotate.c              | 10 ++++++++++
  2 files changed, 17 insertions(+)
diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
index 80c1be5d566c..33c2521cba4a 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -58,6 +58,13 @@ OPTIONS
  --ignore-vmlinux::
  	Ignore vmlinux files.
  
+--itrace::
+	Options for decoding instruction tracing data. The options are:
+
+include::itrace.txt[]
+
+	To disable decoding entirely, use --no-itrace.
+
  -m::
  --modules::
          Load module symbols. WARNING: use only with -k and LIVE kernel.
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 49627a7bed7c..8f87658eff31 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -474,6 +474,8 @@ int cmd_annotate(int argc, const char **argv)
  			.attr	= perf_event__process_attr,
  			.build_id = perf_event__process_build_id,
  			.tracing_data   = perf_event__process_tracing_data,
+			.auxtrace_info	= perf_event__process_auxtrace_info,
+			.auxtrace	= perf_event__process_auxtrace,
For sample mode, Intel PT also needs:

			.id_index	 = perf_event__process_id_index,
Thanks for testing this patch in the Intel PT environment.
OK, I add the id_index processing function to the v4 patch:
https://lore.kernel.org/patchwork/patch/1446727/

Thanks,
Jihong
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help