aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tracepoint.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-08-26 02:29:02 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-26 02:29:02 -0400
commit35dce1a99d010f3d738af4ce1b9b77302fdfe69c (patch)
treee34a37de965a79a2ae301de4d0557f500111dde6 /include/linux/tracepoint.h
parent7cb2e3ee2aeec5b83ecadba929a2dc575dd4008f (diff)
parent1c569f0264ea629c10bbab471dd0626ce4d3f19f (diff)
Merge branch 'tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing into tracing/core
Conflicts: include/linux/tracepoint.h Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/tracepoint.h')
-rw-r--r--include/linux/tracepoint.h46
1 files changed, 18 insertions, 28 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 0341f2e2698a..63a3f7a80580 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -23,6 +23,8 @@ struct tracepoint;
23struct tracepoint { 23struct tracepoint {
24 const char *name; /* Tracepoint name */ 24 const char *name; /* Tracepoint name */
25 int state; /* State. */ 25 int state; /* State. */
26 void (*regfunc)(void);
27 void (*unregfunc)(void);
26 void **funcs; 28 void **funcs;
27} __attribute__((aligned(32))); /* 29} __attribute__((aligned(32))); /*
28 * Aligned on 32 bytes because it is 30 * Aligned on 32 bytes because it is
@@ -60,10 +62,8 @@ struct tracepoint {
60 * Make sure the alignment of the structure in the __tracepoints section will 62 * Make sure the alignment of the structure in the __tracepoints section will
61 * not add unwanted padding between the beginning of the section and the 63 * not add unwanted padding between the beginning of the section and the
62 * structure. Force alignment to the same alignment as the section start. 64 * structure. Force alignment to the same alignment as the section start.
63 * An optional set of (un)registration functions can be passed to perform any
64 * additional (un)registration work.
65 */ 65 */
66#define DECLARE_TRACE_WITH_CALLBACK(name, proto, args, reg, unreg) \ 66#define DECLARE_TRACE(name, proto, args) \
67 extern struct tracepoint __tracepoint_##name; \ 67 extern struct tracepoint __tracepoint_##name; \
68 static inline void trace_##name(proto) \ 68 static inline void trace_##name(proto) \
69 { \ 69 { \
@@ -73,36 +73,23 @@ struct tracepoint {
73 } \ 73 } \
74 static inline int register_trace_##name(void (*probe)(proto)) \ 74 static inline int register_trace_##name(void (*probe)(proto)) \
75 { \ 75 { \
76 int ret; \ 76 return tracepoint_probe_register(#name, (void *)probe); \
77 void (*func)(void) = reg; \
78 \
79 ret = tracepoint_probe_register(#name, (void *)probe); \
80 if (func && !ret) \
81 func(); \
82 return ret; \
83 } \ 77 } \
84 static inline int unregister_trace_##name(void (*probe)(proto)) \ 78 static inline int unregister_trace_##name(void (*probe)(proto)) \
85 { \ 79 { \
86 int ret; \ 80 return tracepoint_probe_unregister(#name, (void *)probe);\
87 void (*func)(void) = unreg; \
88 \
89 ret = tracepoint_probe_unregister(#name, (void *)probe);\
90 if (func && !ret) \
91 func(); \
92 return ret; \
93 } 81 }
94 82
95 83
96#define DECLARE_TRACE(name, proto, args) \ 84#define DEFINE_TRACE_FN(name, reg, unreg) \
97 DECLARE_TRACE_WITH_CALLBACK(name, TP_PROTO(proto), TP_ARGS(args),\
98 NULL, NULL);
99
100#define DEFINE_TRACE(name) \
101 static const char __tpstrtab_##name[] \ 85 static const char __tpstrtab_##name[] \
102 __attribute__((section("__tracepoints_strings"))) = #name; \ 86 __attribute__((section("__tracepoints_strings"))) = #name; \
103 struct tracepoint __tracepoint_##name \ 87 struct tracepoint __tracepoint_##name \
104 __attribute__((section("__tracepoints"), aligned(32))) = \ 88 __attribute__((section("__tracepoints"), aligned(32))) = \
105 { __tpstrtab_##name, 0, NULL } 89 { __tpstrtab_##name, 0, reg, unreg, NULL }
90
91#define DEFINE_TRACE(name) \
92 DEFINE_TRACE_FN(name, NULL, NULL);
106 93
107#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \ 94#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \
108 EXPORT_SYMBOL_GPL(__tracepoint_##name) 95 EXPORT_SYMBOL_GPL(__tracepoint_##name)
@@ -113,7 +100,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
113 struct tracepoint *end); 100 struct tracepoint *end);
114 101
115#else /* !CONFIG_TRACEPOINTS */ 102#else /* !CONFIG_TRACEPOINTS */
116#define DECLARE_TRACE_WITH_CALLBACK(name, proto, args, reg, unreg) \ 103#define DECLARE_TRACE(name, proto, args) \
117 static inline void _do_trace_##name(struct tracepoint *tp, proto) \ 104 static inline void _do_trace_##name(struct tracepoint *tp, proto) \
118 { } \ 105 { } \
119 static inline void trace_##name(proto) \ 106 static inline void trace_##name(proto) \
@@ -127,10 +114,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
127 return -ENOSYS; \ 114 return -ENOSYS; \
128 } 115 }
129 116
130#define DECLARE_TRACE(name, proto, args) \ 117#define DEFINE_TRACE_FN(name, reg, unreg)
131 DECLARE_TRACE_WITH_CALLBACK(name, TP_PROTO(proto), TP_ARGS(args),\
132 NULL, NULL);
133
134#define DEFINE_TRACE(name) 118#define DEFINE_TRACE(name)
135#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) 119#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
136#define EXPORT_TRACEPOINT_SYMBOL(name) 120#define EXPORT_TRACEPOINT_SYMBOL(name)
@@ -291,9 +275,15 @@ static inline void tracepoint_synchronize_unregister(void)
291 * can also by used by generic instrumentation like SystemTap), and 275 * can also by used by generic instrumentation like SystemTap), and
292 * it is also used to expose a structured trace record in 276 * it is also used to expose a structured trace record in
293 * /sys/kernel/debug/tracing/events/. 277 * /sys/kernel/debug/tracing/events/.
278 *
279 * A set of (un)registration functions can be passed to the variant
280 * TRACE_EVENT_FN to perform any (un)registration work.
294 */ 281 */
295 282
296#define TRACE_EVENT(name, proto, args, struct, assign, print) \ 283#define TRACE_EVENT(name, proto, args, struct, assign, print) \
297 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 284 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
285#define TRACE_EVENT_FN(name, proto, args, struct, \
286 assign, print, reg, unreg) \
287 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
298 288
299#endif /* ifdef TRACE_EVENT (see note above) */ 289#endif /* ifdef TRACE_EVENT (see note above) */