linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	David Ahern <dsahern@gmail.com>,
	linux-kernel@vger.kernel.org,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	yrl.pp-manager.tt@hitachi.com
Subject: Re: [PATCH -tip v4 0/5] perf script: add BTS analysis features
Date: Fri, 20 Jan 2012 16:59:12 +0900	[thread overview]
Message-ID: <4F191ED0.8070305@hitachi.com> (raw)
In-Reply-To: <20120118114833.GB1024@somewhere.redhat.com>

(2012/01/18 20:48), Frederic Weisbecker wrote:
> On Mon, Jan 16, 2012 at 02:21:46PM +0900, Akihiro Nagai wrote:
>> Hi Frederic, David,
>>
>> This patch series adds the functions to analyze BTS logs to perf-script and,
>> makes perf-script more informative version 4.
>> The patches add the following functions.
>>   - Unify the expression to "[unknown]"
>>   - Fix BTS record header to resolve DSOs and symbols of user-space
>>   - 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
>> [snip]
>> 402c1c main+0x0             (/root/bin/ls)       3430c21399 __libc_start_main+0xe9 (/lib64/libc-2.14.so)
>
> I was confused first, looking for the reason why we have a so strange branch flow
> until I realized the format is "to from".
>
> Can we have "from to" instead? This will be much more intuitive. "from =>  to" would be even better.
Exactly.
perf records branch_to information in perf_sample->addr, and branch_from in perf_sample->ip.
And, currently I use the generic function: process_event() in builtin-script.c to print
branch information. This function prints perf_sample->addr before it prints perf_sample->ip.

So, I'm going to add the bts specialized codes to process_event().

static void process_event(...)
{
     <snip>
     print_sample_start(sample, thread, attr);

     if (is_bts_event(attr)) {
         print_sample_bts(...);
         return;
     }

     if (PRINT_FIELD(TRACE))
     <snip>
}

Thank you.
>
> Thanks!
>
>> 40b390 set_program_name+0x0 (/root/bin/ls)           402c41 main+0x25              (/root/bin/ls)
>> 40b390 set_program_name+0x0 (/root/bin/ls) ffffffff814ac5ed irq_return+0x0         (/lib/modules/3.2.0+/build/vmlinux)
>> 401e20 strrchr@plt+0x0      (/root/bin/ls)           40b39e set_program_name+0xe   (/root/bin/ls)
>> 401e26 strrchr@plt+0x6      (/root/bin/ls)           401e20 strrchr@plt+0x0        (/root/bin/ls)
>> 401b80 _init+0x18           (/root/bin/ls)           401e2b strrchr@plt+0xb        (/root/bin/ls)
>> 3430813850 _dl_runtime_resolve+0x0 (/lib64/ld-2.14.so) 401b86 _init+0x1e           (/root/bin/ls)
>> [snip]
>

  reply	other threads:[~2012-01-20  7:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16  5:21 [PATCH -tip v4 0/5] perf script: add BTS analysis features Akihiro Nagai
2012-01-16  5:22 ` [PATCH -tip v4 1/5] perf-script: unify the expressions indicate "unknown" Akihiro Nagai
2012-01-17 15:37   ` David Ahern
2012-01-17 15:49   ` Arnaldo Carvalho de Melo
2012-01-18  4:43     ` Akihiro Nagai
2012-01-18  4:47       ` David Ahern
2012-01-19  8:05         ` Akihiro Nagai
2012-01-16  5:22 ` [PATCH -tip v4 2/5] perf: set correct value to perf_event_header.misc for BTS Akihiro Nagai
2012-01-16  5:22 ` [PATCH -tip v4 3/5] perf script: enhance IP and ADDR correlate detection " Akihiro Nagai
2012-01-16  5:22 ` [PATCH -tip v4 4/5] perf script: add the offset field specifier Akihiro Nagai
2012-01-17 16:04   ` David Ahern
2012-01-16  5:22 ` [PATCH -tip v4 5/5] perf script: add option resolving vmlinux path Akihiro Nagai
2012-01-18 11:48 ` [PATCH -tip v4 0/5] perf script: add BTS analysis features Frederic Weisbecker
2012-01-20  7:59   ` Akihiro Nagai [this message]
2012-01-20 13:38     ` Frederic Weisbecker

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=4F191ED0.8070305@hitachi.com \
    --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;
as well as URLs for NNTP newsgroup(s).