diff options
Diffstat (limited to 'include/linux/tracepoint.h')
| -rw-r--r-- | include/linux/tracepoint.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index b9dc4ca0246f..63a3f7a80580 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -23,6 +23,8 @@ struct tracepoint; | |||
| 23 | struct tracepoint { | 23 | struct 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 |
| @@ -78,12 +80,16 @@ struct tracepoint { | |||
| 78 | return tracepoint_probe_unregister(#name, (void *)probe);\ | 80 | return tracepoint_probe_unregister(#name, (void *)probe);\ |
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | #define DEFINE_TRACE(name) \ | 83 | |
| 84 | #define DEFINE_TRACE_FN(name, reg, unreg) \ | ||
| 82 | static const char __tpstrtab_##name[] \ | 85 | static const char __tpstrtab_##name[] \ |
| 83 | __attribute__((section("__tracepoints_strings"))) = #name; \ | 86 | __attribute__((section("__tracepoints_strings"))) = #name; \ |
| 84 | struct tracepoint __tracepoint_##name \ | 87 | struct tracepoint __tracepoint_##name \ |
| 85 | __attribute__((section("__tracepoints"), aligned(32))) = \ | 88 | __attribute__((section("__tracepoints"), aligned(32))) = \ |
| 86 | { __tpstrtab_##name, 0, NULL } | 89 | { __tpstrtab_##name, 0, reg, unreg, NULL } |
| 90 | |||
| 91 | #define DEFINE_TRACE(name) \ | ||
| 92 | DEFINE_TRACE_FN(name, NULL, NULL); | ||
| 87 | 93 | ||
| 88 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \ | 94 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \ |
| 89 | EXPORT_SYMBOL_GPL(__tracepoint_##name) | 95 | EXPORT_SYMBOL_GPL(__tracepoint_##name) |
| @@ -108,6 +114,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin, | |||
| 108 | return -ENOSYS; \ | 114 | return -ENOSYS; \ |
| 109 | } | 115 | } |
| 110 | 116 | ||
| 117 | #define DEFINE_TRACE_FN(name, reg, unreg) | ||
| 111 | #define DEFINE_TRACE(name) | 118 | #define DEFINE_TRACE(name) |
| 112 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) | 119 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) |
| 113 | #define EXPORT_TRACEPOINT_SYMBOL(name) | 120 | #define EXPORT_TRACEPOINT_SYMBOL(name) |
| @@ -158,6 +165,15 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 158 | 165 | ||
| 159 | #define PARAMS(args...) args | 166 | #define PARAMS(args...) args |
| 160 | 167 | ||
| 168 | #endif /* _LINUX_TRACEPOINT_H */ | ||
| 169 | |||
| 170 | /* | ||
| 171 | * Note: we keep the TRACE_EVENT outside the include file ifdef protection. | ||
| 172 | * This is due to the way trace events work. If a file includes two | ||
| 173 | * trace event headers under one "CREATE_TRACE_POINTS" the first include | ||
| 174 | * will override the TRACE_EVENT and break the second include. | ||
| 175 | */ | ||
| 176 | |||
| 161 | #ifndef TRACE_EVENT | 177 | #ifndef TRACE_EVENT |
| 162 | /* | 178 | /* |
| 163 | * For use with the TRACE_EVENT macro: | 179 | * For use with the TRACE_EVENT macro: |
| @@ -259,10 +275,15 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 259 | * can also by used by generic instrumentation like SystemTap), and | 275 | * can also by used by generic instrumentation like SystemTap), and |
| 260 | * it is also used to expose a structured trace record in | 276 | * it is also used to expose a structured trace record in |
| 261 | * /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. | ||
| 262 | */ | 281 | */ |
| 263 | 282 | ||
| 264 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ | 283 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ |
| 265 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 284 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
| 266 | #endif | 285 | #define TRACE_EVENT_FN(name, proto, args, struct, \ |
| 286 | assign, print, reg, unreg) \ | ||
| 287 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | ||
| 267 | 288 | ||
| 268 | #endif | 289 | #endif /* ifdef TRACE_EVENT (see note above) */ |
