tracing: add interface to write into current tracer buffer
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / trace / trace_events.h
blobb015d7b19878ac8caf037c2712e40725cea65bba
1 #ifndef _LINUX_KERNEL_TRACE_EVENTS_H
2 #define _LINUX_KERNEL_TRACE_EVENTS_H
4 #include <linux/debugfs.h>
5 #include <linux/ftrace.h>
6 #include "trace.h"
8 struct ftrace_event_call {
9 char *name;
10 char *system;
11 struct dentry *dir;
12 int enabled;
13 int (*regfunc)(void);
14 void (*unregfunc)(void);
18 #undef TPFMT
19 #define TPFMT(fmt, args...) fmt "\n", ##args
21 #undef TRACE_FORMAT
22 #define TRACE_FORMAT(call, proto, args, fmt) \
23 static void ftrace_event_##call(proto) \
24 { \
25 event_trace_printk(_RET_IP_, "(" #call ") " fmt); \
26 } \
28 static int ftrace_reg_event_##call(void) \
29 { \
30 int ret; \
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 } \
39 static void ftrace_unreg_event_##call(void) \
40 { \
41 unregister_trace_##call(ftrace_event_##call); \
42 } \
44 static struct ftrace_event_call __used \
45 __attribute__((__aligned__(4))) \
46 __attribute__((section("_ftrace_events"))) event_##call = { \
47 .name = #call, \
48 .system = STR(TRACE_SYSTEM), \
49 .regfunc = ftrace_reg_event_##call, \
50 .unregfunc = ftrace_unreg_event_##call, \
53 void event_trace_printk(unsigned long ip, const char *fmt, ...);
54 extern struct ftrace_event_call __start_ftrace_events[];
55 extern struct ftrace_event_call __stop_ftrace_events[];
57 #endif /* _LINUX_KERNEL_TRACE_EVENTS_H */