From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>,
Christoph Lameter <cl@linux-foundation.org>,
rostedt <rostedt@goodmis.org>
Subject: [RFC PATCH] Tracepoint: introduce tracepoint() API
Date: Thu, 17 Nov 2011 15:50:53 -0500 [thread overview]
Message-ID: <20111117205053.GA26484@Krystal> (raw)
In-Reply-To: <20111117155617.GA12665@Krystal>
Introduce:
tracepoint(event_name, arg1, arg2, ...)
while keeping the old tracepoint API in place, e.g.:
trace_event_name(arg1, arg2, ...)
This allows skipping parameter side-effects (pointer dereference,
function calls, ...) when the tracepoint is not dynamically activated.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index d530a44..c9c73f7 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -107,6 +107,12 @@ void tracepoint_update_probe_range(struct tracepoint * const *begin,
#ifdef CONFIG_TRACEPOINTS
+#define tracepoint(name, args...) \
+ do { \
+ if (static_branch(&__tracepoint_##name.key)) \
+ __trace_##name(args); \
+ } while (0)
+
/*
* it_func[0] is never NULL because there is at least one element in the array
* when the array itself is non NULL.
@@ -144,13 +150,17 @@ void tracepoint_update_probe_range(struct tracepoint * const *begin,
*/
#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
extern struct tracepoint __tracepoint_##name; \
+ static inline void __trace_##name(proto) \
+ { \
+ __DO_TRACE(&__tracepoint_##name, \
+ TP_PROTO(data_proto), \
+ TP_ARGS(data_args), \
+ TP_CONDITION(cond)); \
+ } \
static inline void trace_##name(proto) \
{ \
if (static_branch(&__tracepoint_##name.key)) \
- __DO_TRACE(&__tracepoint_##name, \
- TP_PROTO(data_proto), \
- TP_ARGS(data_args), \
- TP_CONDITION(cond)); \
+ __trace_##name(args); \
} \
static inline int \
register_trace_##name(void (*probe)(data_proto), void *data) \
@@ -193,7 +203,12 @@ void tracepoint_update_probe_range(struct tracepoint * const *begin,
EXPORT_SYMBOL(__tracepoint_##name)
#else /* !CONFIG_TRACEPOINTS */
+
+#define tracepoint(name, args...) __trace_##name(args)
+
#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
+ static inline void __trace_##name(proto) \
+ { } \
static inline void trace_##name(proto) \
{ } \
static inline int \
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2011-11-17 20:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 3:55 [RFC] tracepoint/jump_label overhead Eric Dumazet
2011-11-17 15:25 ` Peter Zijlstra
2011-11-17 15:38 ` Avi Kivity
2011-11-17 15:56 ` Mathieu Desnoyers
2011-11-17 20:50 ` Mathieu Desnoyers [this message]
2011-11-17 21:06 ` [RFC PATCH] Tracepoint: introduce tracepoint() API Steven Rostedt
2011-11-17 21:58 ` Jason Baron
2011-11-17 22:27 ` Steven Rostedt
2011-11-17 23:25 ` Mathieu Desnoyers
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=20111117205053.GA26484@Krystal \
--to=mathieu.desnoyers@efficios.com \
--cc=cl@linux-foundation.org \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).