lkml.org 
[lkml]   [2019]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] tracing: introduce TRACE_EVENT_NONE()
Date
Sometimes we want define a tracepoint as a do-nothing function.
So I introduce this TRACE_EVENT_NONE() for this kind of usage.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
include/linux/tracepoint.h | 8 ++++++++
include/trace/define_trace.h | 4 ++++
2 files changed, 12 insertions(+)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 9c31865..d00c5e6 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -548,4 +548,12 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)

#define TRACE_EVENT_PERF_PERM(event, expr...)

+#define TRACE_EVENT_NONE(name, proto) \
+ static inline void trace_##name(proto) \
+ { } \
+ static inline bool trace_##name##_enabled(void) \
+ { \
+ return false; \
+ }
+
#endif /* ifdef TRACE_EVENT (see note above) */
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index cb30c55..a833b6f 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -46,6 +46,9 @@
assign, print, reg, unreg) \
DEFINE_TRACE_FN(name, reg, unreg)

+#undef TRACE_EVENT_NONE
+#define TRACE_EVENT_NONE(name, proto)
+
#undef DEFINE_EVENT
#define DEFINE_EVENT(template, name, proto, args) \
DEFINE_TRACE(name)
@@ -102,6 +105,7 @@
#undef TRACE_EVENT_FN
#undef TRACE_EVENT_FN_COND
#undef TRACE_EVENT_CONDITION
+#undef TRACE_EVENT_NONE
#undef DECLARE_EVENT_CLASS
#undef DEFINE_EVENT
#undef DEFINE_EVENT_FN
--
1.8.3.1
\
 
 \ /
  Last update: 2019-03-26 02:41    [W:0.078 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site