aboutsummaryrefslogtreecommitdiff
path: root/kernel/trace/trace_events.h
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-02-24 10:21:36 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-02-24 21:54:05 -0500
commitb77e38aa240c3bd9c55c98b9f7c81541e042eae5 (patch)
treebbb40993e76edc52d2cae1040b941ba4e4d2f965 /kernel/trace/trace_events.h
parent7c37730cd31ddb2d3a1da142af9b18c29b8c433b (diff)
tracing: add event trace infrastructure
This patch creates the event tracing infrastructure of ftrace. It will create the files: /debug/tracing/available_events /debug/tracing/set_event The available_events will list the trace points that have been registered with the event tracer. set_events will allow the user to enable or disable an event hook. example: # echo sched_wakeup > /debug/tracing/set_event Will enable the sched_wakeup event (if it is registered). # echo "!sched_wakeup" >> /debug/tracing/set_event Will disable the sched_wakeup event (and only that event). # echo > /debug/tracing/set_event Will disable all events (notice the '>') # cat /debug/tracing/available_events > /debug/tracing/set_event Will enable all registered event hooks. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace_events.h')
-rw-r--r--kernel/trace/trace_events.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/kernel/trace/trace_events.h b/kernel/trace/trace_events.h
new file mode 100644
index 00000000000..39342f86db2
--- /dev/null
+++ b/kernel/trace/trace_events.h
@@ -0,0 +1,52 @@
+#ifndef _LINUX_KERNEL_TRACE_EVENTS_H
+#define _LINUX_KERNEL_TRACE_EVENTS_H
+
+#include <linux/ftrace.h>
+#include "trace.h"
+
+struct ftrace_event_call {
+ char *name;
+ int enabled;
+ int (*regfunc)(void);
+ void (*unregfunc)(void);
+};
+
+
+#undef TPFMT
+#define TPFMT(fmt, args...) fmt "\n", ##args
+
+#undef DEFINE_TRACE_FMT
+#define DEFINE_TRACE_FMT(call, proto, args, fmt) \
+static void ftrace_event_##call(proto) \
+{ \
+ event_trace_printk(_RET_IP_, "(" #call ") " fmt); \
+} \
+ \
+static int ftrace_reg_event_##call(void) \
+{ \
+ int ret; \
+ \
+ ret = register_trace_##call(ftrace_event_##call); \
+ if (!ret) \
+ pr_info("event trace: Could not activate trace point " \
+ "probe to " #call); \
+ return ret; \
+} \
+ \
+static void ftrace_unreg_event_##call(void) \
+{ \
+ unregister_trace_##call(ftrace_event_##call); \
+} \
+ \
+static struct ftrace_event_call __used \
+__attribute__((section("_ftrace_events"))) event_##call = { \
+ .name = #call, \
+ .regfunc = ftrace_reg_event_##call, \
+ .unregfunc = ftrace_unreg_event_##call, \
+}
+
+void event_trace_printk(unsigned long ip, const char *fmt, ...);
+extern unsigned long __start_ftrace_events[];
+extern unsigned long __stop_ftrace_events[];
+
+#endif /* _LINUX_KERNEL_TRACE_EVENTS_H */