Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 1 | #ifndef _LINUX_TRACEPOINT_H |
| 2 | #define _LINUX_TRACEPOINT_H |
| 3 | |
| 4 | /* |
| 5 | * Kernel Tracepoint API. |
| 6 | * |
Li Hong | 8cd09a5 | 2009-09-22 18:00:44 +0800 | [diff] [blame] | 7 | * See Documentation/trace/tracepoints.txt. |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 8 | * |
| 9 | * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> |
| 10 | * |
| 11 | * Heavily inspired from the Linux Kernel Markers. |
| 12 | * |
| 13 | * This file is released under the GPLv2. |
| 14 | * See the file COPYING for more details. |
| 15 | */ |
| 16 | |
Wu Zhangjin | b70e4f0 | 2010-06-21 19:09:09 +0800 | [diff] [blame] | 17 | #include <linux/errno.h> |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 18 | #include <linux/types.h> |
| 19 | #include <linux/rcupdate.h> |
| 20 | |
| 21 | struct module; |
| 22 | struct tracepoint; |
| 23 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 24 | struct tracepoint_func { |
| 25 | void *func; |
| 26 | void *data; |
| 27 | }; |
| 28 | |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 29 | struct tracepoint { |
| 30 | const char *name; /* Tracepoint name */ |
| 31 | int state; /* State. */ |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 32 | void (*regfunc)(void); |
| 33 | void (*unregfunc)(void); |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 34 | struct tracepoint_func *funcs; |
Mathieu Desnoyers | 7e066fb | 2008-11-14 17:47:47 -0500 | [diff] [blame] | 35 | } __attribute__((aligned(32))); /* |
| 36 | * Aligned on 32 bytes because it is |
| 37 | * globally visible and gcc happily |
| 38 | * align these on the structure size. |
| 39 | * Keep in sync with vmlinux.lds.h. |
| 40 | */ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 41 | |
Steven Rostedt | 2e26ca7 | 2010-05-05 10:52:31 -0400 | [diff] [blame] | 42 | /* |
| 43 | * Connect a probe to a tracepoint. |
| 44 | * Internal API, should not be used directly. |
| 45 | */ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 46 | extern int tracepoint_probe_register(const char *name, void *probe, void *data); |
Steven Rostedt | 2e26ca7 | 2010-05-05 10:52:31 -0400 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | * Disconnect a probe from a tracepoint. |
| 50 | * Internal API, should not be used directly. |
| 51 | */ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 52 | extern int |
| 53 | tracepoint_probe_unregister(const char *name, void *probe, void *data); |
Steven Rostedt | 2e26ca7 | 2010-05-05 10:52:31 -0400 | [diff] [blame] | 54 | |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 55 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe, |
| 56 | void *data); |
| 57 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe, |
| 58 | void *data); |
Steven Rostedt | 2e26ca7 | 2010-05-05 10:52:31 -0400 | [diff] [blame] | 59 | extern void tracepoint_probe_update_all(void); |
| 60 | |
| 61 | struct tracepoint_iter { |
| 62 | struct module *module; |
| 63 | struct tracepoint *tracepoint; |
| 64 | }; |
| 65 | |
| 66 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); |
| 67 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); |
| 68 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); |
| 69 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); |
| 70 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, |
| 71 | struct tracepoint *begin, struct tracepoint *end); |
| 72 | |
| 73 | /* |
| 74 | * tracepoint_synchronize_unregister must be called between the last tracepoint |
| 75 | * probe unregistration and the end of module exit to make sure there is no |
| 76 | * caller executing a probe when it is freed. |
| 77 | */ |
| 78 | static inline void tracepoint_synchronize_unregister(void) |
| 79 | { |
| 80 | synchronize_sched(); |
| 81 | } |
| 82 | |
| 83 | #define PARAMS(args...) args |
| 84 | |
| 85 | #ifdef CONFIG_TRACEPOINTS |
| 86 | extern void tracepoint_update_probe_range(struct tracepoint *begin, |
| 87 | struct tracepoint *end); |
| 88 | #else |
| 89 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, |
| 90 | struct tracepoint *end) |
| 91 | { } |
| 92 | #endif /* CONFIG_TRACEPOINTS */ |
| 93 | |
| 94 | #endif /* _LINUX_TRACEPOINT_H */ |
| 95 | |
| 96 | /* |
| 97 | * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include |
| 98 | * file ifdef protection. |
| 99 | * This is due to the way trace events work. If a file includes two |
| 100 | * trace event headers under one "CREATE_TRACE_POINTS" the first include |
| 101 | * will override the TRACE_EVENT and break the second include. |
| 102 | */ |
| 103 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 104 | #ifndef DECLARE_TRACE |
| 105 | |
Steven Rostedt | 2939b04 | 2009-03-09 15:47:18 -0400 | [diff] [blame] | 106 | #define TP_PROTO(args...) args |
Li Hong | 8cd09a5 | 2009-09-22 18:00:44 +0800 | [diff] [blame] | 107 | #define TP_ARGS(args...) args |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 108 | |
| 109 | #ifdef CONFIG_TRACEPOINTS |
| 110 | |
| 111 | /* |
| 112 | * it_func[0] is never NULL because there is at least one element in the array |
| 113 | * when the array itself is non NULL. |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 114 | * |
| 115 | * Note, the proto and args passed in includes "__data" as the first parameter. |
| 116 | * The reason for this is to handle the "void" prototype. If a tracepoint |
| 117 | * has a "void" prototype, then it is invalid to declare a function |
| 118 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just |
| 119 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 120 | */ |
| 121 | #define __DO_TRACE(tp, proto, args) \ |
| 122 | do { \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 123 | struct tracepoint_func *it_func_ptr; \ |
| 124 | void *it_func; \ |
| 125 | void *__data; \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 126 | \ |
Mathieu Desnoyers | da7b3ea | 2008-11-14 17:47:43 -0500 | [diff] [blame] | 127 | rcu_read_lock_sched_notrace(); \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 128 | it_func_ptr = rcu_dereference_sched((tp)->funcs); \ |
| 129 | if (it_func_ptr) { \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 130 | do { \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 131 | it_func = (it_func_ptr)->func; \ |
| 132 | __data = (it_func_ptr)->data; \ |
| 133 | ((void(*)(proto))(it_func))(args); \ |
| 134 | } while ((++it_func_ptr)->func); \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 135 | } \ |
Mathieu Desnoyers | da7b3ea | 2008-11-14 17:47:43 -0500 | [diff] [blame] | 136 | rcu_read_unlock_sched_notrace(); \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 137 | } while (0) |
| 138 | |
| 139 | /* |
| 140 | * Make sure the alignment of the structure in the __tracepoints section will |
| 141 | * not add unwanted padding between the beginning of the section and the |
| 142 | * structure. Force alignment to the same alignment as the section start. |
| 143 | */ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 144 | #define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ |
Mathieu Desnoyers | 7e066fb | 2008-11-14 17:47:47 -0500 | [diff] [blame] | 145 | extern struct tracepoint __tracepoint_##name; \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 146 | static inline void trace_##name(proto) \ |
| 147 | { \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 148 | if (unlikely(__tracepoint_##name.state)) \ |
| 149 | __DO_TRACE(&__tracepoint_##name, \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 150 | TP_PROTO(data_proto), \ |
| 151 | TP_ARGS(data_args)); \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 152 | } \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 153 | static inline int \ |
| 154 | register_trace_##name(void (*probe)(data_proto), void *data) \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 155 | { \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 156 | return tracepoint_probe_register(#name, (void *)probe, \ |
| 157 | data); \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 158 | } \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 159 | static inline int \ |
| 160 | unregister_trace_##name(void (*probe)(data_proto), void *data) \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 161 | { \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 162 | return tracepoint_probe_unregister(#name, (void *)probe, \ |
| 163 | data); \ |
Mathieu Desnoyers | 53da59a | 2010-04-30 12:59:59 -0400 | [diff] [blame] | 164 | } \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 165 | static inline void \ |
| 166 | check_trace_callback_type_##name(void (*cb)(data_proto)) \ |
Mathieu Desnoyers | 53da59a | 2010-04-30 12:59:59 -0400 | [diff] [blame] | 167 | { \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 168 | } |
| 169 | |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 170 | #define DEFINE_TRACE_FN(name, reg, unreg) \ |
Mathieu Desnoyers | 7e066fb | 2008-11-14 17:47:47 -0500 | [diff] [blame] | 171 | static const char __tpstrtab_##name[] \ |
| 172 | __attribute__((section("__tracepoints_strings"))) = #name; \ |
| 173 | struct tracepoint __tracepoint_##name \ |
| 174 | __attribute__((section("__tracepoints"), aligned(32))) = \ |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 175 | { __tpstrtab_##name, 0, reg, unreg, NULL } |
| 176 | |
| 177 | #define DEFINE_TRACE(name) \ |
| 178 | DEFINE_TRACE_FN(name, NULL, NULL); |
Mathieu Desnoyers | 7e066fb | 2008-11-14 17:47:47 -0500 | [diff] [blame] | 179 | |
| 180 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \ |
| 181 | EXPORT_SYMBOL_GPL(__tracepoint_##name) |
| 182 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ |
| 183 | EXPORT_SYMBOL(__tracepoint_##name) |
| 184 | |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 185 | #else /* !CONFIG_TRACEPOINTS */ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 186 | #define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 187 | static inline void trace_##name(proto) \ |
| 188 | { } \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 189 | static inline int \ |
| 190 | register_trace_##name(void (*probe)(data_proto), \ |
| 191 | void *data) \ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 192 | { \ |
| 193 | return -ENOSYS; \ |
| 194 | } \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 195 | static inline int \ |
| 196 | unregister_trace_##name(void (*probe)(data_proto), \ |
| 197 | void *data) \ |
Mathieu Desnoyers | c420970 | 2008-11-14 17:47:44 -0500 | [diff] [blame] | 198 | { \ |
| 199 | return -ENOSYS; \ |
Mathieu Desnoyers | 53da59a | 2010-04-30 12:59:59 -0400 | [diff] [blame] | 200 | } \ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 201 | static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \ |
Mathieu Desnoyers | 53da59a | 2010-04-30 12:59:59 -0400 | [diff] [blame] | 202 | { \ |
Mathieu Desnoyers | c420970 | 2008-11-14 17:47:44 -0500 | [diff] [blame] | 203 | } |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 204 | |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 205 | #define DEFINE_TRACE_FN(name, reg, unreg) |
Mathieu Desnoyers | 7e066fb | 2008-11-14 17:47:47 -0500 | [diff] [blame] | 206 | #define DEFINE_TRACE(name) |
| 207 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) |
| 208 | #define EXPORT_TRACEPOINT_SYMBOL(name) |
| 209 | |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 210 | #endif /* CONFIG_TRACEPOINTS */ |
Steven Rostedt | 38516ab | 2010-04-20 17:04:50 -0400 | [diff] [blame] | 211 | |
| 212 | /* |
| 213 | * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype |
| 214 | * (void). "void" is a special value in a function prototype and can |
| 215 | * not be combined with other arguments. Since the DECLARE_TRACE() |
| 216 | * macro adds a data element at the beginning of the prototype, |
| 217 | * we need a way to differentiate "(void *data, proto)" from |
| 218 | * "(void *data, void)". The second prototype is invalid. |
| 219 | * |
| 220 | * DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype |
| 221 | * and "void *__data" as the callback prototype. |
| 222 | * |
| 223 | * DECLARE_TRACE() passes "proto" as the tracepoint protoype and |
| 224 | * "void *__data, proto" as the callback prototype. |
| 225 | */ |
| 226 | #define DECLARE_TRACE_NOARGS(name) \ |
| 227 | __DECLARE_TRACE(name, void, , void *__data, __data) |
| 228 | |
| 229 | #define DECLARE_TRACE(name, proto, args) \ |
| 230 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ |
| 231 | PARAMS(void *__data, proto), \ |
| 232 | PARAMS(__data, args)) |
| 233 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 234 | #endif /* DECLARE_TRACE */ |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 235 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 236 | #ifndef TRACE_EVENT |
Steven Rostedt | 823f912 | 2009-03-10 12:58:51 -0400 | [diff] [blame] | 237 | /* |
| 238 | * For use with the TRACE_EVENT macro: |
| 239 | * |
| 240 | * We define a tracepoint, its arguments, its printk format |
| 241 | * and its 'fast binay record' layout. |
| 242 | * |
| 243 | * Firstly, name your tracepoint via TRACE_EVENT(name : the |
| 244 | * 'subsystem_event' notation is fine. |
| 245 | * |
| 246 | * Think about this whole construct as the |
| 247 | * 'trace_sched_switch() function' from now on. |
| 248 | * |
| 249 | * |
| 250 | * TRACE_EVENT(sched_switch, |
| 251 | * |
| 252 | * * |
| 253 | * * A function has a regular function arguments |
| 254 | * * prototype, declare it via TP_PROTO(): |
| 255 | * * |
| 256 | * |
Steven Rostedt | ef18012 | 2009-03-10 14:10:56 -0400 | [diff] [blame] | 257 | * TP_PROTO(struct rq *rq, struct task_struct *prev, |
| 258 | * struct task_struct *next), |
Steven Rostedt | 823f912 | 2009-03-10 12:58:51 -0400 | [diff] [blame] | 259 | * |
| 260 | * * |
| 261 | * * Define the call signature of the 'function'. |
| 262 | * * (Design sidenote: we use this instead of a |
| 263 | * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.) |
| 264 | * * |
| 265 | * |
Steven Rostedt | ef18012 | 2009-03-10 14:10:56 -0400 | [diff] [blame] | 266 | * TP_ARGS(rq, prev, next), |
Steven Rostedt | 823f912 | 2009-03-10 12:58:51 -0400 | [diff] [blame] | 267 | * |
| 268 | * * |
| 269 | * * Fast binary tracing: define the trace record via |
| 270 | * * TP_STRUCT__entry(). You can think about it like a |
| 271 | * * regular C structure local variable definition. |
| 272 | * * |
| 273 | * * This is how the trace record is structured and will |
| 274 | * * be saved into the ring buffer. These are the fields |
| 275 | * * that will be exposed to user-space in |
GeunSik Lim | 156f5a7 | 2009-06-02 15:01:37 +0900 | [diff] [blame] | 276 | * * /sys/kernel/debug/tracing/events/<*>/format. |
Steven Rostedt | 823f912 | 2009-03-10 12:58:51 -0400 | [diff] [blame] | 277 | * * |
| 278 | * * The declared 'local variable' is called '__entry' |
| 279 | * * |
| 280 | * * __field(pid_t, prev_prid) is equivalent to a standard declariton: |
| 281 | * * |
| 282 | * * pid_t prev_pid; |
| 283 | * * |
| 284 | * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to: |
| 285 | * * |
| 286 | * * char prev_comm[TASK_COMM_LEN]; |
| 287 | * * |
| 288 | * |
| 289 | * TP_STRUCT__entry( |
| 290 | * __array( char, prev_comm, TASK_COMM_LEN ) |
| 291 | * __field( pid_t, prev_pid ) |
| 292 | * __field( int, prev_prio ) |
| 293 | * __array( char, next_comm, TASK_COMM_LEN ) |
| 294 | * __field( pid_t, next_pid ) |
| 295 | * __field( int, next_prio ) |
| 296 | * ), |
| 297 | * |
| 298 | * * |
| 299 | * * Assign the entry into the trace record, by embedding |
| 300 | * * a full C statement block into TP_fast_assign(). You |
| 301 | * * can refer to the trace record as '__entry' - |
| 302 | * * otherwise you can put arbitrary C code in here. |
| 303 | * * |
| 304 | * * Note: this C code will execute every time a trace event |
| 305 | * * happens, on an active tracepoint. |
| 306 | * * |
| 307 | * |
Steven Rostedt | ef18012 | 2009-03-10 14:10:56 -0400 | [diff] [blame] | 308 | * TP_fast_assign( |
| 309 | * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); |
| 310 | * __entry->prev_pid = prev->pid; |
| 311 | * __entry->prev_prio = prev->prio; |
Steven Rostedt | 823f912 | 2009-03-10 12:58:51 -0400 | [diff] [blame] | 312 | * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); |
| 313 | * __entry->next_pid = next->pid; |
Steven Rostedt | ef18012 | 2009-03-10 14:10:56 -0400 | [diff] [blame] | 314 | * __entry->next_prio = next->prio; |
Steven Rostedt | 823f912 | 2009-03-10 12:58:51 -0400 | [diff] [blame] | 315 | * ) |
| 316 | * |
| 317 | * * |
| 318 | * * Formatted output of a trace record via TP_printk(). |
| 319 | * * This is how the tracepoint will appear under ftrace |
| 320 | * * plugins that make use of this tracepoint. |
| 321 | * * |
| 322 | * * (raw-binary tracing wont actually perform this step.) |
| 323 | * * |
| 324 | * |
| 325 | * TP_printk("task %s:%d [%d] ==> %s:%d [%d]", |
| 326 | * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, |
| 327 | * __entry->next_comm, __entry->next_pid, __entry->next_prio), |
| 328 | * |
| 329 | * ); |
| 330 | * |
| 331 | * This macro construct is thus used for the regular printk format |
| 332 | * tracing setup, it is used to construct a function pointer based |
| 333 | * tracepoint callback (this is used by programmatic plugins and |
| 334 | * can also by used by generic instrumentation like SystemTap), and |
| 335 | * it is also used to expose a structured trace record in |
GeunSik Lim | 156f5a7 | 2009-06-02 15:01:37 +0900 | [diff] [blame] | 336 | * /sys/kernel/debug/tracing/events/. |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 337 | * |
| 338 | * A set of (un)registration functions can be passed to the variant |
| 339 | * TRACE_EVENT_FN to perform any (un)registration work. |
Steven Rostedt | 823f912 | 2009-03-10 12:58:51 -0400 | [diff] [blame] | 340 | */ |
| 341 | |
Ingo Molnar | 091ad36 | 2009-11-26 09:04:55 +0100 | [diff] [blame] | 342 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) |
Steven Rostedt | ff038f5 | 2009-11-18 20:27:27 -0500 | [diff] [blame] | 343 | #define DEFINE_EVENT(template, name, proto, args) \ |
| 344 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
Steven Rostedt | e5bc972 | 2009-11-18 20:36:26 -0500 | [diff] [blame] | 345 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ |
| 346 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
Steven Rostedt | ff038f5 | 2009-11-18 20:27:27 -0500 | [diff] [blame] | 347 | |
Steven Rostedt | 30a8fec | 2009-03-10 12:41:38 -0400 | [diff] [blame] | 348 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ |
Steven Rostedt | da4d030 | 2009-03-09 17:14:30 -0400 | [diff] [blame] | 349 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 350 | #define TRACE_EVENT_FN(name, proto, args, struct, \ |
| 351 | assign, print, reg, unreg) \ |
| 352 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
Steven Rostedt | 7cb2e3e | 2009-08-26 00:32:37 -0400 | [diff] [blame] | 353 | |
| 354 | #endif /* ifdef TRACE_EVENT (see note above) */ |