public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
To: Arnaldo Carvalho de Melo <acme@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	David Ahern <dsahern@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	yrl.pp-manager.tt@hitachi.com
Subject: [PATCH -tip v2 0/6] perf script: add BTS analysis features
Date: Sun, 17 Jul 2011 18:30:31 +0900	[thread overview]
Message-ID: <20110717093031.3447.52715.stgit@linux3> (raw)

Hi Frederic, David,

This patch series adds the functions to analyze BTS logs to perf-script and,
makes perf-script more informative version 2.
The patches add the following functions.
 - Output correct IP address
 - Output "(unknown)" as symbol name when perf-script can't resolve symbols.
 - Output "[unknown]" as DSO name when perf-script can't resolve DSO path.
 - Resolve DSOs and symbols for user-space address
 - Resolve DSOs and symbols for BTS's branch_from addresses
 - Show the offset of symbols with the 'offs' field specifier.
 - Resolve the real path of [kernel.kallsym] using
   '--show-kernel-path' option.

Usage:
First, get the BTS log with the following command.
# perf record -e branches:u -c 1 -d <command>

Second, analyze that trace data.
# perf script -f ip,addr,sym,offs,dso [--show-kernel-path]
This command's output format is:
<branch_to addr> <branch_to function+offset> <branch_to DSO> <branch_from addr> <branch_from function+offset> <branch_from DSO>

Output sample:
# perf record -e branches:u -c 1 -d ls
[snip]
# perf script -f ip,addr,sym,dso,offs --show-kernel-path

301ec016b0      (unknown) (/lib/modules/3.0.0-rc6-tip+/build/vmlinux) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc6-tip+/build/vmlinux)
301ec016b0     _start+0x0 (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc6-tip+/build/vmlinux)
301ec04b70  _dl_start+0x0 (/lib64/ld-2.14.so)       301ec016b3 _start+0x3 (/lib64/ld-2.14.so)
301ec04b70  _dl_start+0x0 (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc6-tip+/build/vmlinux)
301ec04b96 _dl_start+0x26 (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc6-tip+/build/vmlinux)
301ec04b9d _dl_start+0x2d (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc6-tip+/build/vmlinux)
301ec04c0d _dl_start+0x9d (/lib64/ld-2.14.so)       301ec04beb _dl_start+0x7b (/lib64/ld-2.14.so)
[snip]
401fd0                 main+0x0 (/root/bin/ls)       301f021399 __libc_start_main+0xe9 (/lib64/libc-2.14.so)
409ad0     set_program_name+0x0 (/root/bin/ls)           401ff3 main+0x23 (/root/bin/ls)
409ad0     set_program_name+0x0 (/root/bin/ls) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc6-tip+/build/vmlinux)
401ca8          strrchr@plt+0x0 (/root/bin/ls)           409ade set_program_name+0xe (/root/bin/ls)
401cae          strrchr@plt+0x6 (/root/bin/ls)           401ca8 strrchr@plt+0x0 (/root/bin/ls)
401a38               _init+0x18 (/root/bin/ls)           401cb3 strrchr@plt+0xb (/root/bin/ls)
301ec13840 _dl_runtime_resolve+0x0 (/lib64/ld-2.14.so)   401a3e _init+0x1e (/root/bin/ls)
301ec0d6a0        _dl_fixup+0x0 (/lib64/ld-2.14.so)  301ec13870 _dl_runtime_resolve+0x30 (/lib64/ld-2.14.so)
[snip]

It shows the tracee application's execution path.


TODO:
 - add source code path field, line number field ...etc.
 - add record/report script to use easily and, show human-friendly output.
 - filtering kernel functions using scripts

Changes in v2:
 - add a bug fix patch that prints correct IP address
 - output the magic word "(unknown)" as symbol name when perf-script can't
   resolve symbols.
 - output "[unknown]" as DSO name when perf-script can't resolve DSO path.
 - change the way to output offset of symbols from '--show-symbol-offset' to
   'offs' field.
 - clean up codes.

Thanks,

---

Akihiro Nagai (6):
      perf script: add option resolving vmlinux path
      perf script: add the offset field specifier
      perf script: print DSOs and symbols for BTS branch_from addr
      perf script: resolve DSOs and symbols for user-space
      perf script: add magic word to indicate the failure of resolving symbols
      [BUGFIX] perf script: print correct IP address


 tools/perf/Documentation/perf-script.txt |    5 +++
 tools/perf/builtin-script.c              |   46 +++++++++++++++++++++---------
 tools/perf/util/event.c                  |    5 +++
 tools/perf/util/map.c                    |   15 ++++++++++
 tools/perf/util/map.h                    |    1 +
 tools/perf/util/session.c                |   42 ++++++++++-----------------
 tools/perf/util/session.h                |    3 +-
 tools/perf/util/symbol.c                 |   21 ++++++++++++++
 tools/perf/util/symbol.h                 |    4 +++
 9 files changed, 100 insertions(+), 42 deletions(-)

-- 
Akihiro Nagai (akihiro.nagai.hw@hitachi.com)

             reply	other threads:[~2011-07-17  9:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-17  9:30 Akihiro Nagai [this message]
2011-07-17  9:30 ` [PATCH -tip v2 1/6] [BUGFIX] perf script: print correct IP address Akihiro Nagai
2011-07-17 15:59   ` David Ahern
2011-07-17 17:29     ` Frederic Weisbecker
2011-07-17  9:30 ` [PATCH -tip v2 2/6] perf script: add magic word to indicate the failure of resolving symbols Akihiro Nagai
2011-07-17 16:07   ` David Ahern
2011-07-17 16:30     ` David Ahern
2011-07-21  9:36       ` Akihiro Nagai
2011-07-21  9:42         ` Peter Zijlstra
2011-07-21 14:39         ` David Ahern
2011-07-22  4:25           ` Akihiro Nagai
2011-07-17  9:30 ` [PATCH -tip v2 3/6] perf script: resolve DSOs and symbols for user-space Akihiro Nagai
2011-07-17 16:20   ` David Ahern
2011-07-21  9:36     ` Akihiro Nagai
2011-07-17  9:31 ` [PATCH -tip v2 4/6] perf script: print DSOs and symbols for BTS branch_from addr Akihiro Nagai
2011-07-17 16:22   ` David Ahern
2011-07-21  9:36     ` Akihiro Nagai
2011-07-17  9:31 ` [PATCH -tip v2 5/6] perf script: add the offset field specifier Akihiro Nagai
2011-07-17 16:28   ` David Ahern
2011-07-17  9:31 ` [PATCH -tip v2 6/6] perf script: add option resolving vmlinux path Akihiro Nagai
2011-07-17 16:36   ` David Ahern
2011-07-21  9:36     ` Akihiro Nagai

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=20110717093031.3447.52715.stgit@linux3 \
    --to=akihiro.nagai.hw@hitachi.com \
    --cc=acme@infradead.org \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=yrl.pp-manager.tt@hitachi.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