From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: <rostedt@goodmis.org>, <masami.hiramatsu.pt@hitachi.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 00/11] tracing: trace event triggers
Date: Sat, 29 Jun 2013 17:30:23 +0800 [thread overview]
Message-ID: <51CEA92F.3040802@huawei.com> (raw)
In-Reply-To: <cover.1372479499.git.tom.zanussi@linux.intel.com>
On 2013/6/29 13:08, Tom Zanussi wrote:
> Hi,
>
> This is v2 of the trace event triggers patchset, addressing comments
> from Masami Hiramatsu, zhangwei(Jovi), and Steve Rostedt (thanks for
> reviewing v1).
>
> v2:
> - removed all changes to __ftrace_event_enable_disable() (except
> for patch 04/11 which clears the soft_disabled bit as discussed)
> and created a separate trace_event_trigger_enable_disable() that
> calls it after setting/clearing the TRIGGER_MODE_BIT.
> - added a trigger_mode enum for future patches that break up the
> trigger calls for filtering, but that's also now used as a command
> id for registering/unregistering commands.
> - removed the enter_file/exit_file members that were added to
> syscall_metadata after realizing that they were unnecessary if
> ftrace_syscall_enter/exit() were modified to receive a pointer
> to the ftrace_file instead of the pointer to the trace_array in
> the ftrace_file.
> - broke up the trigger invocation into two parts so that triggers
> like 'stacktrace' that themselves log into the trace buffer can
> defer the actual trigger invocation until after the current
> record is closed, which is needed for the filter check that
> in turn determines whether the trigger gets invoked.
> - other minor cleanup
>
>
> This patchset implements 'trace event triggers', which are similar to
> the function triggers implemented for 'ftrace filter commands' (see
> 'Filter commands' in Documentation/trace/ftrace.txt), but instead of
> being invoked from function calls are invoked by trace events.
> Basically the patchset allows 'commands' to be triggered whenever a
> given trace event is hit. The set of commands implemented by this
> patchset are:
>
> - enable/disable_event - enable or disable another event whenever
> the trigger event is hit
>
> - stacktrace - dump a stacktrace to the trace buffer whenever the
> trigger event is hit
>
> - snapshot - create a snapshot of the current trace buffer whenever
> the trigger event is hit
>
> - traceon/traceoff - turn tracing on or off whenever the trigger
> event is hit
>
> Triggers can also be conditionally invoked by associating a standard
> trace event filter with them - if the given event passes the filter,
> the trigger is invoked, otherwise it's not. (see 'Event filtering' in
> Documentation/trace/events.txt for info on event filters).
>
I just aware that we are implementing more and more scripting functionality into
tracing subsystem, like filter and trigger mode, of cause we don't call it
as scripting, but basically the pattern is same, all is "do something when event hit".
FYI, a pretty simple scripting module of tracing is there:
https://github.com/ktap/ktap.git
For the trigger mode, you can perform any command when event hit if using scripting,
in contrast with this patchset, ktap use perf callback handler to invoke command,
so it don't need extra code to support trigger mode in tracepoint/k(ret)probe/u(ret)probe.
---------------------
trace "syscalls:*" function (e) {
printf("%d %d\t%s\t%s", cpu(), pid(), execname(), e.tostring())
}
---------------------
trace "probe:do_sys_open dfd=%di filename=%dx flags=%cx mode=+4($stack)" function (e) {
printf("%d %d\t%s\t%s", cpu(), pid(), execname(), e.tostring())
}
---------------------
trace "probe:do_sys_open%return fd=$retval" function (e) {
printf("%d %d\t%s\t%s", cpu(), pid(), execname(), e.tostring())
}
---------------------
trace "probe:/lib/libc.so.6:0x000773c0" function (e) {
printf("%d %d\t%s\t%s", cpu(), pid(), execname(), e.tostring())
}
what I'm thinking now is perhaps we can use a more generic mechanism in future
to let user do more magic things when event hit.
To be clear, I'm not against on this patchset, I'm on the same side with Tom,
the trigger mode of this patchset is useful(awesome work). I'm just sharing some extra info,
hopeful you don't mind it :)
Thanks.
jovi
next prev parent reply other threads:[~2013-06-29 9:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-29 5:08 [PATCH v2 00/11] tracing: trace event triggers Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 01/11] tracing: simplify event_enable_read() Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 02/11] tracing: add missing syscall_metadata comment Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 03/11] tracing: add soft disable for syscall events Tom Zanussi
2013-06-29 6:26 ` zhangwei(Jovi)
2013-07-01 11:26 ` Masami Hiramatsu
2013-06-29 5:08 ` [PATCH v2 04/11] tracing: fix disabling of soft disable Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 05/11] tracing: add basic event trigger framework Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 06/11] tracing: add 'traceon' and 'traceoff' event trigger commands Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 07/11] tracing: add 'snapshot' event trigger command Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 08/11] tracing: add 'stacktrace' " Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 09/11] tracing: add 'enable_event' and 'disable_event' event trigger commands Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 10/11] tracing: add and use generic set_trigger_filter() implementation Tom Zanussi
2013-06-29 5:08 ` [PATCH v2 11/11] tracing: add documentation for trace event triggers Tom Zanussi
2013-06-29 9:30 ` zhangwei(Jovi) [this message]
2013-07-01 12:32 ` Re: [PATCH v2 00/11] tracing: " Masami Hiramatsu
2013-07-02 4:53 ` zhangwei(Jovi)
2013-07-01 15:49 ` Tom Zanussi
2013-07-02 3:54 ` zhangwei(Jovi)
2013-07-02 14:46 ` Tom Zanussi
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=51CEA92F.3040802@huawei.com \
--to=jovi.zhangwei@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=rostedt@goodmis.org \
--cc=tom.zanussi@linux.intel.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).