| Steven Rostedt | b77e38a | 2009-02-24 10:21:36 -0500 | [diff] [blame^] | 1 | #ifndef _LINUX_KERNEL_TRACE_EVENTS_H |
| 2 | #define _LINUX_KERNEL_TRACE_EVENTS_H |
| 3 | |
| 4 | #include <linux/ftrace.h> |
| 5 | #include "trace.h" |
| 6 | |
| 7 | struct ftrace_event_call { |
| 8 | char *name; |
| 9 | int enabled; |
| 10 | int (*regfunc)(void); |
| 11 | void (*unregfunc)(void); |
| 12 | }; |
| 13 | |
| 14 | |
| 15 | #undef TPFMT |
| 16 | #define TPFMT(fmt, args...) fmt "\n", ##args |
| 17 | |
| 18 | #undef DEFINE_TRACE_FMT |
| 19 | #define DEFINE_TRACE_FMT(call, proto, args, fmt) \ |
| 20 | static void ftrace_event_##call(proto) \ |
| 21 | { \ |
| 22 | event_trace_printk(_RET_IP_, "(" #call ") " fmt); \ |
| 23 | } \ |
| 24 | \ |
| 25 | static int ftrace_reg_event_##call(void) \ |
| 26 | { \ |
| 27 | int ret; \ |
| 28 | \ |
| 29 | ret = register_trace_##call(ftrace_event_##call); \ |
| 30 | if (!ret) \ |
| 31 | pr_info("event trace: Could not activate trace point " \ |
| 32 | "probe to " #call); \ |
| 33 | return ret; \ |
| 34 | } \ |
| 35 | \ |
| 36 | static void ftrace_unreg_event_##call(void) \ |
| 37 | { \ |
| 38 | unregister_trace_##call(ftrace_event_##call); \ |
| 39 | } \ |
| 40 | \ |
| 41 | static struct ftrace_event_call __used \ |
| 42 | __attribute__((section("_ftrace_events"))) event_##call = { \ |
| 43 | .name = #call, \ |
| 44 | .regfunc = ftrace_reg_event_##call, \ |
| 45 | .unregfunc = ftrace_unreg_event_##call, \ |
| 46 | } |
| 47 | |
| 48 | void event_trace_printk(unsigned long ip, const char *fmt, ...); |
| 49 | extern unsigned long __start_ftrace_events[]; |
| 50 | extern unsigned long __stop_ftrace_events[]; |
| 51 | |
| 52 | #endif /* _LINUX_KERNEL_TRACE_EVENTS_H */ |