From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Christian Convey <christian.convey@gmail.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Milian Wolff <milian.wolff@kdab.com>,
linux-perf-users <linux-perf-users@vger.kernel.org>
Subject: Re: newbie question: tracing userspace call/return sequences
Date: Mon, 9 Jan 2017 22:33:54 +0530 [thread overview]
Message-ID: <20170109170354.GD13299@naverao1-tp.localdomain> (raw)
In-Reply-To: <CAPfS4ZzKPTPrBJY+yhMBte_wyVgTnt-kuDUGF39BxV0NZs+TDQ@mail.gmail.com>
On 2017/01/09 10:19AM, Christian Convey wrote:
> Hi Masami,
>
> On Sat, Jan 7, 2017 at 6:44 PM, Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > No, you can use $params for tracing all function parameters :)
> > So, please try "* $params" instead of "*".
>
> Thanks for the tip! I tried it out, and got some strange results: The
> correct set of function parameter names is present in
> "trace_unhandled" 's "event_fields_dict" dictionary. However, the
> actual runtime values of those parameters is sometimes inaccurate.
>
> I'm using a simple Fibonacci program with just two functions: "main"
> and "fibfunc".
>
> Here are my steps:
>
> gcc -g -fno-omit-frame-pointer -O0 fib.c -o fib
>
> export PERF_EXEC_PATH=/home/cconvey/src/linux-4.8.0/tools/perf
>
> sudo -E ${PERF_EXEC_PATH}/perf probe --exec=./fib --del='*'
>
> sudo -E ${PERF_EXEC_PATH}/perf probe --exec=./fib --add='* $params'
>
> sudo -E ${PERF_EXEC_PATH}/perf record -e 'probe_fib:*' -aR ./fib 3
>
> # My script which currently just prints the parameters passed to
> 'trace_unhandled'.
> sudo -E ${PERF_EXEC_PATH}/perf script -s ./perf-script-2.py
>
>
> Here's an example of the output from my script:
>
> > in trace_begin
> > event_name = "probe_fib__main"
> > event_fields_dict: {'common_callchain': [], 'common_pid': 18631, 'common_s': 98414, 'common_comm': 'fib', 'common_ns': 209748661, 'argv': 94718640125824, 'common_cpu': 6, 'argc': 22053, '__probe_ip': 94718640125737}
> >
> > event_name = "probe_fib__fibfunc"
> > event_fields_dict: {'common_callchain': [], 'common_pid': 18631, 'common_s': 98414, 'common_comm': 'fib', 'common_ns': 209756797, 'n': 0, 'common_cpu': 6, '__probe_ip': 94718640125664}
> >
> > event_name = "probe_fib__fibfunc"
> > event_fields_dict: {'common_callchain': [], 'common_pid': 18631, 'common_s': 98414, 'common_comm': 'fib', 'common_ns': 209757849, 'n': 32764, 'common_cpu': 6, '__probe_ip': 94718640125664}
> >
> > event_name = "probe_fib__fibfunc"
> > event_fields_dict: {'common_callchain': [], 'common_pid': 18631, 'common_s': 98414, 'common_comm': 'fib', 'common_ns': 209758915, 'n': 2, 'common_cpu': 6, '__probe_ip': 94718640125664}
> >
> > in trace_end
>
> Notice, for example, that the reported value for "argc" is 22053, rather than 2.
>
> Any idea why that might be happening?
Try compiling your program with -O2, or use a newer perf:
https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?id=e47392bf9c0613a058cd20ee89d8ce9d957d4b24
- Naveen
next prev parent reply other threads:[~2017-01-09 17:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-06 3:49 newbie question: tracing userspace call/return sequences Christian Convey
2017-01-06 10:16 ` Milian Wolff
2017-01-06 20:05 ` Christian Convey
2017-01-07 23:44 ` Masami Hiramatsu
2017-01-09 15:19 ` Christian Convey
2017-01-09 17:03 ` Naveen N. Rao [this message]
2017-01-09 17:59 ` Christian Convey
2017-01-10 0:25 ` Masami Hiramatsu
2017-01-10 2:32 ` Christian Convey
2017-01-06 18:49 ` Andi Kleen
2017-01-06 19:07 ` Christian Convey
2017-01-07 4:37 ` Namhyung Kim
2017-01-07 18:26 ` Christian Convey
2017-01-07 19:08 ` Andi Kleen
2017-01-08 8:08 ` Namhyung Kim
2017-01-06 19:23 ` Arnaldo Carvalho de Melo
2017-01-09 17:20 ` Frank Ch. Eigler
2017-01-09 18:08 ` Christian Convey
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=20170109170354.GD13299@naverao1-tp.localdomain \
--to=naveen.n.rao@linux.vnet.ibm.com \
--cc=christian.convey@gmail.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=milian.wolff@kdab.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).