From: tip-bot for Steven Rostedt <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
rostedt@goodmis.org, seiji.aguchi@hds.com, tglx@linutronix.de,
hpa@linux.intel.com
Subject: [tip:x86/trace] tracing: Add DEFINE_EVENT_FN() macro
Date: Thu, 20 Jun 2013 22:57:32 -0700 [thread overview]
Message-ID: <tip-f5abaa1bfc3dbf26d19d3513f39279ca369f8d65@git.kernel.org> (raw)
In-Reply-To: <51C3236C.8030508@hds.com>
Commit-ID: f5abaa1bfc3dbf26d19d3513f39279ca369f8d65
Gitweb: http://git.kernel.org/tip/f5abaa1bfc3dbf26d19d3513f39279ca369f8d65
Author: Steven Rostedt <rostedt@goodmis.org>
AuthorDate: Thu, 20 Jun 2013 11:44:44 -0400
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 20 Jun 2013 22:24:32 -0700
tracing: Add DEFINE_EVENT_FN() macro
Each TRACE_EVENT() adds several helper functions. If two or more trace events
share the same structure and print format, they can also share most of these
helper functions and save a lot of space from duplicate code. This is why the
DECLARE_EVENT_CLASS() and DEFINE_EVENT() were created.
Some events require a trigger to be called at registering and unregistering of
the event and to do so they use TRACE_EVENT_FN().
If multiple events require a trigger, they currently have no choice but to use
TRACE_EVENT_FN() as there's no DEFINE_EVENT_FN() available. This unfortunately
causes a lot of wasted duplicate code created.
By adding a DEFINE_EVENT_FN(), these events can still use a
DECLARE_EVENT_CLASS() and then define their own triggers.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/51C3236C.8030508@hds.com
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
include/linux/tracepoint.h | 2 ++
include/trace/define_trace.h | 5 +++++
include/trace/ftrace.h | 4 ++++
3 files changed, 11 insertions(+)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index f8e084d..ebeab36 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -378,6 +378,8 @@ static inline void tracepoint_synchronize_unregister(void)
#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
#define DEFINE_EVENT(template, name, proto, args) \
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\
+ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#define DEFINE_EVENT_CONDITION(template, name, proto, \
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 1905ca8..02e1003 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -44,6 +44,10 @@
#define DEFINE_EVENT(template, name, proto, args) \
DEFINE_TRACE(name)
+#undef DEFINE_EVENT_FN
+#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
+ DEFINE_TRACE_FN(name, reg, unreg)
+
#undef DEFINE_EVENT_PRINT
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
DEFINE_TRACE(name)
@@ -91,6 +95,7 @@
#undef TRACE_EVENT_CONDITION
#undef DECLARE_EVENT_CLASS
#undef DEFINE_EVENT
+#undef DEFINE_EVENT_FN
#undef DEFINE_EVENT_PRINT
#undef DEFINE_EVENT_CONDITION
#undef TRACE_HEADER_MULTI_READ
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 19edd7f..d615f78 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -71,6 +71,10 @@
static struct ftrace_event_call __used \
__attribute__((__aligned__(4))) event_##name
+#undef DEFINE_EVENT_FN
+#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
+ DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
+
#undef DEFINE_EVENT_PRINT
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
next prev parent reply other threads:[~2013-06-21 5:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 15:44 [PATCH v17 0/4] trace,x86: irq vector tracepoint support Seiji Aguchi
2013-06-20 15:44 ` [PATCH v17 1/4] tracing: Add DEFINE_EVENT_FN() macro Seiji Aguchi
2013-06-21 5:57 ` tip-bot for Steven Rostedt [this message]
2013-06-20 15:45 ` [PATCH v17 2/4] trace,x86: Introduce entering/exiting_irq() Seiji Aguchi
2013-06-21 5:57 ` [tip:x86/trace] x86, trace: " tip-bot for Seiji Aguchi
2013-06-20 15:45 ` [PATCH v17 3/4] x86: Rename variables for debugging Seiji Aguchi
2013-06-21 5:57 ` [tip:x86/trace] " tip-bot for Seiji Aguchi
2013-06-20 15:46 ` [PATCH v17 4/4] trace,x86: Add irq vector tracepoints Seiji Aguchi
2013-06-21 5:58 ` [tip:x86/trace] x86, trace: " tip-bot for Seiji Aguchi
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=tip-f5abaa1bfc3dbf26d19d3513f39279ca369f8d65@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=seiji.aguchi@hds.com \
--cc=tglx@linutronix.de \
/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
Powered by JetHome