public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@elte.hu, paulus@samba.org, davem@davemloft.net,
	fweisbec@gmail.com, perfmon2-devel@lists.sf.net,
	eranian@gmail.com, tzanussi@gmail.com
Subject: Re: how to use perf annotate on the kernel
Date: Thu, 3 Jun 2010 14:54:45 -0300	[thread overview]
Message-ID: <20100603175445.GC8928@ghostprotocols.net> (raw)
In-Reply-To: <AANLkTik2yNxwCHl7FZAyOG4Vt56RlLi59oZR5Jo6o9ox@mail.gmail.com>

Em Thu, Jun 03, 2010 at 07:23:02PM +0200, Stephane Eranian escreveu:
> Arnaldo,
> 
> I am trying to understand how one is supposed
> to use perf annotate to get sample correlations
> with kernel symbols.
> 
> I do:
> 
> # perf record -a -e cycles:k dd if=/dev/zero of=/dev/null count=1000000
> # perf report
> 
> # Events: 14K cycles
> #
> # Overhead          Command        Shared Object  Symbol
> # ........  ...............  ...................  ......
> #
>      8.76%               dd  [kernel.kallsyms]    [k] __lock_acquire
>      7.49%               dd  [kernel.kallsyms]    [k] sched_clock
> 
> # perf annotate (or annotate -d '[kernel.kallsyms]'?)
> Can't annotate __lock_acquire: No vmlinux file was found in the path
> 
> # perf annotate -k vmlinux
> objdump: '[kernel.kallsyms]': No such file

This looks like a bug in how it reports this problem, probably vmlinux
is not in the current directory, or it is but has a build-id that
doesn't matches the one in the perf.data file.

But the message is wrong, should be like it is in the tui, for this same
situation:

	ui_helpline__puts("No vmlinux file found, can't "
			  "annotate with just a kallsyms file");

> Am I missing something here?

If you don't specify it with --vmlinux/-k it will try to find it in one
of these places:

        vmlinux_path[vmlinux_path__nr_entries] = strdup("vmlinux");
        if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
                goto out_fail;
        ++vmlinux_path__nr_entries;
        vmlinux_path[vmlinux_path__nr_entries] = strdup("/boot/vmlinux");
        if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
                goto out_fail;
        ++vmlinux_path__nr_entries;
        snprintf(bf, sizeof(bf), "/boot/vmlinux-%s", uts.release);
        vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
        if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
                goto out_fail;
        ++vmlinux_path__nr_entries;
        snprintf(bf, sizeof(bf), "/lib/modules/%s/build/vmlinux", uts.release);
        vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
        if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
                goto out_fail;
        ++vmlinux_path__nr_entries;
        snprintf(bf, sizeof(bf), "/usr/lib/debug/lib/modules/%s/vmlinux",
                 uts.release);
        vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);

It also now looks at /sys/kernel/notes, gets the build-id, and looks up
in the build-id cache.

- Arnaldo

  reply	other threads:[~2010-06-03 17:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03 17:23 how to use perf annotate on the kernel Stephane Eranian
2010-06-03 17:54 ` Arnaldo Carvalho de Melo [this message]
2010-06-03 18:06   ` Arnaldo Carvalho de Melo
2010-06-03 18:11     ` Arnaldo Carvalho de Melo
2010-06-03 18:18       ` Stephane Eranian
2010-06-04  0:20         ` Arnaldo Carvalho de Melo
2010-06-04  0:39           ` Arnaldo Carvalho de Melo
2010-06-04  8:55             ` Stephane Eranian
2010-06-03 18:12     ` Stephane Eranian

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=20100603175445.GC8928@ghostprotocols.net \
    --to=acme@infradead.org \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@infradead.org \
    --cc=tzanussi@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox