Re: [PATCH V2 17/19] perf scripts python: exported-sql-viewer.py: Add All branches report

From: Arnaldo Carvalho de Melo
Date: Tue Oct 23 2018 - 15:29:41 EST


Em Tue, Oct 23, 2018 at 06:41:17PM +0000, Hunter, Adrian escreveu:
> > -----Original Message-----
> > From: Arnaldo Carvalho de Melo [mailto:acme@xxxxxxxxxx]
> > Sent: Tuesday, October 23, 2018 9:12 PM
> > To: Hunter, Adrian <adrian.hunter@xxxxxxxxx>
> > Cc: Jiri Olsa <jolsa@xxxxxxxxxx>; Andi Kleen <ak@xxxxxxxxxxxxxxx>; linux-
> > kernel@xxxxxxxxxxxxxxx
> > Subject: Re: [PATCH V2 17/19] perf scripts python: exported-sql-viewer.py:
> > Add All branches report
> >
> > Em Tue, Oct 23, 2018 at 10:59:49AM +0300, Adrian Hunter escreveu:
> > > Add a report to display branches in a similar fashion to perf script.
> > > The main purpose of this report is to display disassembly, however,
> > > presently, the only supported disassembler is Intel XED, and
> > > additionally the object code must be present in perf build ID cache.
> > >
> > > To use Intel XED, libxed.so must be present. To build and install
> > > libxed.so:
> > > git clone https://github.com/intelxed/mbuild.git mbuild
> > > git clone https://github.com/intelxed/xed
> > > cd xed
> > > ./mfile.py --share
> > > sudo ./mfile.py --prefix=/usr/local install
> > > sudo ldconfig
> > >
> > > Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> > > ---
> > >
> > >
> > > Changes in V2:
> > >
> > > Fix branch report not appearing for kernel-only or user-only tracing:
> > > Find branch events named like "branches:k" or "branches:u" as well
> > as
> > > just plain "branches", by splitting the name at the colon. i.e.
> > > event = event.split(":")[0]
> >
> > So, I followed the instructions then ended up with:
> >
> > [acme@seventh perf]$ find /usr/local -name "*xed*" | head
> > /usr/local/lib/libxed.so /usr/local/lib/libxed.a /usr/local/lib/libxed-ild.so
> > /usr/local/lib/libxed-ild.a /usr/local/include/xed /usr/local/include/xed/xed-
> > syntax-enum.h
> > /usr/local/include/xed/xed-attributes.h
> > /usr/local/include/xed/xed-build-defines.h
> > /usr/local/include/xed/xed-cpuid-rec.h
> > /usr/local/include/xed/xed-flags.h
> > [acme@seventh perf]$
> >
> > Ran ldconfig as root, etc:
> >
> > [acme@seventh perf]$ ldconfig -v -N | grep xed
> > ldconfig: Can't stat /libx32: No such file or directory
> > ldconfig: Path `/usr/lib' given more than once
> > ldconfig: Path `/usr/lib64' given more than once
> > ldconfig: Can't stat /usr/libx32: No such file or directory [acme@seventh
> > perf]$
> >
> > [acme@seventh perf]$ file /usr/local/lib/libxed.so
> > /usr/local/lib/libxed.so: ELF 64-bit LSB shared object, x86-64, version 1
> > (SYSV), dynamically linked,
> > BuildID[sha1]=09cf45310a731f727b4575582a638052b8f3e3bb, not stripped
> > [acme@seventh perf]$ file /usr/local/lib/libxed-ild.so
> > /usr/local/lib/libxed-ild.so: ELF 64-bit LSB shared object, x86-64, version 1
> > (SYSV), dynamically linked,
> > BuildID[sha1]=a5601603e305bb7b7f8edc7da0e78acbc9b63eba, not stripped
> > [acme@seventh perf]$
> >
> > Tried with:
> >
> > export LD_LIBRARY_PATH=/usr/local/lib/
> >
> > But so far couldn't get it to show the disassembly.
> >
> > The "All Branches" is there, wasn't in v1 of this patch.
> >
> > Ideas?
>
> The "All Branches" report is a 2-level tree, and the disassembly displays when the next level of the tree is opened
> i.e. click the arrow at the start of the line.

Right, I pressed on those arrows, nothing appeared, do you have any
hotkey to expand them all at once?

> Have you tried both kernel and user space?

[root@seventh perf]# perf evlist -v
intel_pt//u: type: 8, size: 112, config: 0x300e601, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, exclude_kernel: 1, exclude_hv: 1, sample_id_all: 1
dummy:u: type: 1, size: 112, config: 0x9, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|IDENTIFIER, read_format: ID, inherit: 1, exclude_kernel: 1, exclude_hv: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, mmap2: 1, comm_exec: 1, context_switch: 1
[root@seventh perf]#

Good question, it was with that //u, so just userspace, trying removing
that part.

> The script looks for dsos in the build id cache. The dsos can be viewed by selecting dsos_view from the Tables menu,
> so you could check if that information looks right.
>
> Also the script has a variable "have_disassembler", so you could hack the script to print that to find out if XED is working.
>