[ltt-dev] [RFC UST PATCH] Add define flag for disabling markers/tp
David Goulet
david.goulet at polymtl.ca
Thu Sep 30 16:33:58 EDT 2010
>From Pierre-Marc Fournier comment about what if someone
want to disable markers or/and tracepoints at compile time.
I put back the "foony" code in markers.h (previously removed)
and changed the flag name to follow the namespace. However, the
concept changed a bit. Instead of defining the CONFIG_MARKERS,
it checks if the NOMARKERS/NOTRACEPOINTS flag is set. If so,
the markers/tp are disabled. Also, UST_NOTRACING flag will d
isable tracepoints *and* markers.
That way someone could easily compile a program *without* any
UST tracing mechanism. (Still namespace polution though).
Feedback(s) are VERY welcome!
Thanks
David
Signed-off-by: David Goulet <david.goulet at polymtl.ca>
---
include/ust/marker.h | 26 ++++++++++++++++++++++++--
include/ust/tracepoint.h | 13 ++++++++-----
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/include/ust/marker.h b/include/ust/marker.h
index 6103629..a07ec32 100644
--- a/include/ust/marker.h
+++ b/include/ust/marker.h
@@ -77,6 +77,9 @@ struct marker {
void *location; /* Address of marker in code */
} __attribute__((aligned(8)));
+/* Set this flag to compile *without* UST markers */
+#if !defined(UST_NOMARKERS) && !defined(UST_NOTRACING)
+
#define GET_MARKER(channel, name) (__mark_##channel##_##name)
#define _DEFINE_MARKER(channel, name, tp_name_str, tp_cb, format, unique, m) \
@@ -194,8 +197,27 @@ struct marker {
call_private, ®s, ## args); \
} while (0)
-extern void marker_update_probe_range(struct marker *begin,
- struct marker *end);
+extern void marker_update_probe_range(struct marker *begin, struct marker *end);
+
+#else /* UST_NOMARKERS */
+
+#define DEFINE_MARKER(channel, name, tp_name, tp_cb, format)
+#define __trace_mark(generic, channel, name, call_private, format, args...) \
+ __mark_check_format(format, ## args)
+#define __trace_mark_tp(channel, name, call_private, tp_name, tp_cb, format, args...) \
+ do { \
+ void __check_tp_type(void) \
+ { \
+ register_trace_##tp_name(tp_cb, call_private); \
+ } \
+ __mark_check_format(format, ## args); \
+ } while (0)
+
+static inline void marker_update_probe_range(struct marker *begin, struct marker *end)
+{ }
+
+#define GET_MARKER(channel, name)
+#endif /* UST_NOMARKERS */
/**
* trace_mark - Marker using code patching
diff --git a/include/ust/tracepoint.h b/include/ust/tracepoint.h
index 1c4a384..fe0e3e7 100644
--- a/include/ust/tracepoint.h
+++ b/include/ust/tracepoint.h
@@ -54,8 +54,7 @@ struct tracepoint {
#define TP_PROTO(args...) args
#define TP_ARGS(args...) args
-#define CONFIG_TRACEPOINTS
-#ifdef CONFIG_TRACEPOINTS
+#if !defined(UST_NOTRACEPOINTS) && !defined(UST_NOTRACING)
/*
* it_func[0] is never NULL because there is at least one element in the array
@@ -142,16 +141,20 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
struct tracepoint *end);
#else /* !CONFIG_TRACEPOINTS */
-#define __DECLARE_TRACE(name, proto, args) \
+
+#include <errno.h>
+#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \
static inline void trace_##name(proto) \
{ } \
static inline void _trace_##name(proto) \
{ } \
- static inline int register_trace_##name(void (*probe)(proto)) \
+ static inline int \
+ register_trace_##name(void (*probe)(data_proto), void *data) \
{ \
return -ENOSYS; \
} \
- static inline int unregister_trace_##name(void (*probe)(proto)) \
+ static inline int \
+ unregister_trace_##name(void (*probe)(data_proto), void *data) \
{ \
return -ENOSYS; \
}
--
1.7.3
More information about the lttng-dev
mailing list