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