All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Stephane Eranian <eranian@google.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	linux-perf-users@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [RFC PATCH] perf tui: Annotate entries in callchains
Date: Fri, 20 Mar 2015 18:34:29 -0300	[thread overview]
Message-ID: <20150320213429.GR16485@kernel.org> (raw)
In-Reply-To: <CABPqkBRjHMOzNL=vWqzTUNA_8FidDk=THBErj4c6Tj=6Yw+0hg@mail.gmail.com>

Em Fri, Mar 20, 2015 at 02:12:30PM -0700, Stephane Eranian escreveu:
> On Fri, Mar 20, 2015 at 2:07 PM, Arnaldo Carvalho de Melo
> <arnaldo.melo@gmail.com> wrote:
> > Em Fri, Mar 20, 2015 at 05:39:22PM -0300, Arnaldo Carvalho de Melo escreveu:
> >> Em Fri, Mar 20, 2015 at 10:15:53AM -0700, Stephane Eranian escreveu:
> >> > On Thu, Mar 19, 2015 at 5:39 PM, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> >> > > On Mar 19, 2015 9:34 PM, "Stephane Eranian" <eranian@google.com> wrote:
> >> > >> On Thu, Mar 19, 2015 at 3:58 PM, Arnaldo Carvalho de Melo
> >> > >> <acme@kernel.org> wrote:
> >> > >> >         This patch, together with what is in my perf/core branch, should
> >> > >> > implement that feature we talked about recently, i.e. to allow
> >> > >> > annotating entries in callchains, please take a look at see if you think
> >> > >> > it is ok,

> >> > >> I tried on tip.git and a simple example. It does what I wanted.
> >> > >> I will try on more complex test cases.
> >> > >> Thanks for implementing this quickly.

> >> > > Thanks for testing, please let us know if you have further suggestions,

> >> > Ok, it does not work.
> >
> > Are you sure? I just tried, take a look at:
> >
> > http://vger.kernel.org/~acme/perf-report-annotate-callchain-entries-in-multiple-DSOs-in-the-same-hist_entry.png
> >
> > In there you will see that in the unmap_single_vma case there are
> > callchains that pass thru multiple DSOs in userspace (I used --call
> > dwarf in 'perf record') and those are marked as having
> > samples/annotation and when I go to those, pressing 'a' after moving the
> > cursor to it and it works as expected...

> > Do you have some specific example I could try?

> I tried on an example I cannot share.
> But I am guessing you could reproduce with a test which calls a libc
> or libm function
> heavily form multiple callers in the main program.
> Example:
>        -  pow()
>            50% foo() [main.c]
>            50% bar() [main.c]
> 
> If I move the cursor line to foo() and annotate foo() is shows me the
> code of pow().

+   49.83%  pow-me-harder  pow-me-harder     [.] main
+   27.16%  pow-me-harder  libm-2.17.so      [.] __ieee754_pow_sse2
-   17.76%  pow-me-harder  libm-2.17.so      [.] __pow
   -→__pow libm-2.17.so
      -→80.70% main pow-me-harder
           __libc_start_main libc-2.17.so
           _start pow-me-harder
        16.82% 0x4000000000000000 unknown
        2.44% 0x1 unknown
+    2.57%  pow-me-harder  pow-me-harder     [.] pow@plt
+    2.36%  pow-me-harder  libm-2.17.so      [.] @plt
+    0.04%  pow-me-harder  [kernel.vmlinux]  [k] intel_thermal_interrupt

And if I go to the line:

-→80.70% main pow-me-harder

And press 'a' I get:

main  /home/acme/pow-me-harder
 10.25 │ 3e:   mov    -0x10(%rbp),%rax
  1.03 │       test   %rax,%rax
  4.39 │     ↓ js     53
  3.87 │       cvtsi2 %rax,%xmm3
  1.63 │       movsd  %xmm3,-0x38(%rbp)
       │     ↓ jmp    71
  0.03 │ 53:   mov    %rax,%rdx
  0.91 │       shr    %rdx
  0.29 │       and    $0x1,%eax
  1.85 │       or     %rax,%rdx
  7.38 │       cvtsi2 %rdx,%xmm0
  0.55 │       movapd %xmm0,%xmm2
  6.54 │       addsd  %xmm0,%xmm2
  0.68 │       movsd  %xmm2,-0x38(%rbp)
  1.44 │ 71:   cvtsi2 -0x4(%rbp),%xmm0
  2.82 │       movabs $0x4000000000000000,%rax
  0.62 │       mov    %rax,-0x40(%rbp)
  0.07 │       movsd  -0x40(%rbp),%xmm1
  4.30 │     → callq  pow@plt
  1.53 │       addsd  -0x38(%rbp),%xmm0
  4.13 │       ucomis 0xfd(%rip),%xmm0        # 400818 <__dso_handle+0x10>
  4.06 │     ↓ jae    a8
  1.49 │       cvttsd %xmm0,%rax
  1.49 │       mov    %rax,-0x10(%rbp)
  0.35 │     ↓ jmp    cb
       │ a8:   movsd  0xe8(%rip),%xmm1        # 400818 <__dso_handle+0x10>
  0.14 │       subsd  %xmm1,%xmm0
  2.57 │       cvttsd %xmm0,%rax
  0.66 │       mov    %rax,-0x10(%rbp)
       │       movabs $0x8000000000000000,%rax
  7.84 │       xor    %rax,-0x10(%rbp)
 16.80 │ cb:   mov    -0x10(%rbp),%rax
  2.15 │       mov    %rax,-0x10(%rbp)
       │     int main(int argc, char *argv[])
       │     {
       │             int n = atoi(argv[1]), i;
       │             unsigned long long total = 0; 

While if I go to the line:

   -→__pow libm-2.17.so

And press 'a', I get:

__pow  /usr/lib64/libm-2.17.so
       │     Disassembly of section .text:
       │
       │     0000000000026290 <pow>:
       │     __pow():
       │       movapd %xmm0,%xmm2
       │       sub    $0x18,%rsp
  1.70 │       movapd %xmm1,%xmm3
 12.86 │       movsd  %xmm2,(%rsp)
       │       movsd  %xmm3,0x8(%rsp)
  2.43 │     → callq  *ABS*+0x1b110@plt
  0.49 │       movabs $0x7fffffffffffffff,%rcx
  0.28 │       movabs $0x7fefffffffffffff,%rdx
  1.01 │       movq   %xmm0,%rax
 12.58 │       and    %rcx,%rax
  2.18 │       movsd  (%rsp),%xmm2
  1.29 │       cmp    %rdx,%rax
 19.70 │       movsd  0x8(%rsp),%xmm3
  1.50 │     ↓ ja     57
  1.58 │       xorpd  %xmm1,%xmm1
 13.35 │       ucomis %xmm1,%xmm0
  0.89 │     ↓ jnp    a0
       │ 52:   add    $0x18,%rsp
 16.83 │     ← retq
       │ 57:   mov    _DYNAMIC+0x230,%rsi
       │       cmpl   $0xffffffff,(%rsi)
       │     ↑ je     52


Since I don't have glibc-debuginfo installed, I get just assembly.

[acme@ssdandy linux]$ readelf -sw /usr/lib64/libm-2.17.so | grep -w __pow
  1737: 0000000000026290   429 FUNC    LOCAL  DEFAULT   13 __pow
[acme@ssdandy linux]$ 

Strange, are you pressing 'V' on the main 'perf record' view, i.e. before
getting to the annotation browser, to see the DSO just after the symbol?

Trying with a deeper callchain in pow-me-harder.c...

- Arnaldo

  reply	other threads:[~2015-03-20 21:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 22:58 [RFC PATCH] perf tui: Annotate entries in callchains Arnaldo Carvalho de Melo
2015-03-20  0:34 ` Stephane Eranian
     [not found]   ` <CA+JHD93s2VkkdJMKZOGa6fPwEd43C8Ow80CU0b=bwTV=_8zjhw@mail.gmail.com>
2015-03-20 17:15     ` Stephane Eranian
2015-03-20 17:21       ` Arnaldo Carvalho de Melo
2015-03-20 20:39       ` Arnaldo Carvalho de Melo
2015-03-20 21:07         ` Arnaldo Carvalho de Melo
2015-03-20 21:12           ` Stephane Eranian
2015-03-20 21:34             ` Arnaldo Carvalho de Melo [this message]
2015-03-20 21:45               ` Arnaldo Carvalho de Melo
2015-03-23  0:27             ` Namhyung Kim
2015-03-23 16:49               ` Stephane Eranian
2015-03-23 16:56                 ` Arnaldo Carvalho de Melo
2015-03-27 23:05                   ` Stephane Eranian
2015-03-28 16:24                     ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150320213429.GR16485@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.