blob: b015d7b19878ac8caf037c2712e40725cea65bba [file] [log] [blame]
Steven Rostedtb77e38a2009-02-24 10:21:36 -05001#ifndef _LINUX_KERNEL_TRACE_EVENTS_H
2#define _LINUX_KERNEL_TRACE_EVENTS_H
3
Steven Rostedt1473e442009-02-24 14:15:08 -05004#include <linux/debugfs.h>
Steven Rostedtb77e38a2009-02-24 10:21:36 -05005#include <linux/ftrace.h>
6#include "trace.h"
7
8struct ftrace_event_call {
9 char *name;
Steven Rostedt6ecc2d12009-02-27 21:33:02 -050010 char *system;
Steven Rostedt1473e442009-02-24 14:15:08 -050011 struct dentry *dir;
Steven Rostedtb77e38a2009-02-24 10:21:36 -050012 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 Rostedteef62a62009-02-25 15:49:52 -050021#undef TRACE_FORMAT
22#define TRACE_FORMAT(call, proto, args, fmt) \
Steven Rostedtb77e38a2009-02-24 10:21:36 -050023static void ftrace_event_##call(proto) \
24{ \
25 event_trace_printk(_RET_IP_, "(" #call ") " fmt); \
26} \
27 \
28static 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 \
39static void ftrace_unreg_event_##call(void) \
40{ \
41 unregister_trace_##call(ftrace_event_##call); \
42} \
43 \
44static struct ftrace_event_call __used \
Steven Rostedt1473e442009-02-24 14:15:08 -050045__attribute__((__aligned__(4))) \
Steven Rostedtb77e38a2009-02-24 10:21:36 -050046__attribute__((section("_ftrace_events"))) event_##call = { \
47 .name = #call, \
Steven Rostedt6ecc2d12009-02-27 21:33:02 -050048 .system = STR(TRACE_SYSTEM), \
Steven Rostedtb77e38a2009-02-24 10:21:36 -050049 .regfunc = ftrace_reg_event_##call, \
50 .unregfunc = ftrace_unreg_event_##call, \
51}
52
53void event_trace_printk(unsigned long ip, const char *fmt, ...);
Steven Rostedt1473e442009-02-24 14:15:08 -050054extern struct ftrace_event_call __start_ftrace_events[];
55extern struct ftrace_event_call __stop_ftrace_events[];
Steven Rostedtb77e38a2009-02-24 10:21:36 -050056
57#endif /* _LINUX_KERNEL_TRACE_EVENTS_H */