From: Masami Hiramatsu <mhiramat@kernel.org>
To: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Namhyung Kim <namhyung@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
ananth@linux.vnet.ibm.com
Subject: Re: [PATCH] perf/sdt: Directly record cached SDT events
Date: Tue, 3 May 2016 09:25:39 +0900 [thread overview]
Message-ID: <20160503092539.7abc46b56ec0cf216a0c23e1@kernel.org> (raw)
In-Reply-To: <CAE40pdcOL=Cx4w_PkUqfRfK=A2Nfb0iizXUML7ePHr5DhQ8arQ@mail.gmail.com>
On Mon, 2 May 2016 11:19:34 -0700
Brendan Gregg <brendan.d.gregg@gmail.com> wrote:
> On Fri, Apr 29, 2016 at 6:40 AM, Hemant Kumar <hemant@linux.vnet.ibm.com> wrote:
> > This patch adds support for directly recording SDT events which are
> > present in the probe cache. This patch is based on current SDT
> > enablement patchset (v5) by Masami :
> > https://lkml.org/lkml/2016/4/27/828
> > and it implements two points in the TODO list mentioned in the
> > cover note :
> > "- (perf record) Support SDT event recording directly"
> > "- (perf record) Try to unregister SDT events after record."
> >
> > Without this patch, we could probe into SDT events using
> > "perf probe" and "perf record". With this patch, we can probe
> > the SDT events directly using "perf record".
> >
> > For example :
> >
> > # perf list sdt // List the SDT events
> > ...
> > sdt_mysql:update__row__done [SDT event]
> > sdt_mysql:update__row__start [SDT event]
> > sdt_mysql:update__start [SDT event]
> > sdt_python:function__entry [SDT event]
> > sdt_python:function__return [SDT event]
> > sdt_test:marker1 [SDT event]
> > sdt_test:marker2 [SDT event]
> > ...
> >
> > # perf record -e %sdt_test:marker1 -e %sdt_test:marker2 -a
>
> Why do we need the '%'? Can't the "sdt_" prefix be sufficient? ie:
>
> # perf record -e sdt_test:marker1 -e sdt_test:marker2 -a
For the perf-record side, "sdt_test:marker1" gives just a normal
tracepoint event name (which is common with probe events on
ftrace/perftools). For example, if I add a probe event by perf probe,
it is shown same as other tracepoint events. This means I can make
"sdt_test:marker1" with other address in principle.
----
$ sudo ./perf probe -a "sdt_test:marker1=vmalloc"
Added new event:
sdt_test:marker1 (on vmalloc)
You can now use it in all perf tools, such as:
perf record -e sdt_test:marker1 -aR sleep 1
----
So, you can shot you feet, easily:)
One possible solution is reserving "sdt_" prefix for SDT, then
we can avoid using "%" for that.
However, what I intended was more generic solution including probe-cache,
so that user can freely replay on cached probes once the user defines a
probe, even after rebooting the machine. Of course, we can search such
events automatically if a user gives a non-existing event name.
> I find it a bit weird to define it using %sdt_, but then use it using
> sdt_. I'd also be inclined to use it for probe creation, ie:
>
> # perf probe -x /lib/libc-2.17.so sdt_libc:lll_lock_wait_private
>
> That way, the user only learns one way to specify the probe, with the
> sdt_ prefix. It's fine if % existed too, but optional.
OK, if we can see "sdt_" prefix on the first place, we can treat as there
is "%" :)
> > ^C[ perf record: Woken up 1 times to write data ]
> > [ perf record: Captured and wrote 2.087 MB perf.data (22 samples) ]
> >
> > # perf script
> > test_sdt 29230 [002] 405550.548017: sdt_test:marker1: (400534)
> > test_sdt 29230 [002] 405550.548064: sdt_test:marker2: (40053f)
> > test_sdt 29231 [002] 405550.962806: sdt_test:marker1: (400534)
> > test_sdt 29231 [002] 405550.962841: sdt_test:marker2: (40053f)
> > test_sdt 29232 [001] 405551.379327: sdt_test:marker1: (400534)
> > ...
> >
> > After invoking "perf record", behind the scenes, it checks whether the
> > event specified is an SDT event using the flag '%'. After that, it
> > does a lookup of the probe cache to find out the SDT event. If its not
> > present, it throws an error. Otherwise, it goes on and writes the event
> > into the uprobe_events file and sets up the probe event, trace events,
> > etc and starts recording. It also maintains a list of the event names
> > that were written to uprobe_events file. After finishing the record
> > session, it removes the events from the uprobe_events file using the
> > maintained name list.
>
> Does this support semaphore SDT probes (is-enabled)? Those need the
> semaphore incremented when enabled, then decremented when disabled.
No, not actually supported yet. Semaphore and SDT parameters will be
supported afterwards.
Thank you!
--
Masami Hiramatsu <mhiramat@kernel.org>
prev parent reply other threads:[~2016-05-03 0:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 13:40 [PATCH] perf/sdt: Directly record cached SDT events Hemant Kumar
2016-04-30 12:36 ` Masami Hiramatsu
2016-05-02 23:36 ` Hemant Kumar
2016-05-03 0:35 ` Masami Hiramatsu
2016-05-03 21:18 ` Hemant Kumar
2016-05-02 18:19 ` Brendan Gregg
2016-05-03 0:25 ` Masami Hiramatsu [this message]
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=20160503092539.7abc46b56ec0cf216a0c23e1@kernel.org \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=ananth@linux.vnet.ibm.com \
--cc=brendan.d.gregg@gmail.com \
--cc=hemant@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox