aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-02-15 09:51:51 -0500
committerSteven Rostedt <rostedt@goodmis.org>2012-02-21 11:08:26 -0500
commite59a0bff3ecf389951e3c9378ddfd00f6448bfaa (patch)
tree315214953499b428a6a26d08fe3b5038e4ec5e1e /kernel/trace
parent489c75c3b333dfda4c8d2b7ad1b00e5da024bfa7 (diff)
ftrace: Add FTRACE_ENTRY_REG macro to allow event registration
Adding FTRACE_ENTRY_REG macro so particular ftrace entries could specify registration function and thus become accesible via perf. This will be used in upcomming patch for function trace. Link: http://lkml.kernel.org/r/1329317514-8131-5-git-send-email-jolsa@redhat.com Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.h4
-rw-r--r--kernel/trace/trace_export.c18
2 files changed, 20 insertions, 2 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 55c6ea00f28a..638476af8d7b 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -68,6 +68,10 @@ enum trace_type {
68#undef FTRACE_ENTRY_DUP 68#undef FTRACE_ENTRY_DUP
69#define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk) 69#define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk)
70 70
71#undef FTRACE_ENTRY_REG
72#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \
73 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
74
71#include "trace_entries.h" 75#include "trace_entries.h"
72 76
73/* 77/*
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index bbeec31e0ae3..f74de861cde9 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -18,6 +18,14 @@
18#undef TRACE_SYSTEM 18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM ftrace 19#define TRACE_SYSTEM ftrace
20 20
21/*
22 * The FTRACE_ENTRY_REG macro allows ftrace entry to define register
23 * function and thus become accesible via perf.
24 */
25#undef FTRACE_ENTRY_REG
26#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \
27 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
28
21/* not needed for this file */ 29/* not needed for this file */
22#undef __field_struct 30#undef __field_struct
23#define __field_struct(type, item) 31#define __field_struct(type, item)
@@ -152,13 +160,14 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
152#undef F_printk 160#undef F_printk
153#define F_printk(fmt, args...) #fmt ", " __stringify(args) 161#define F_printk(fmt, args...) #fmt ", " __stringify(args)
154 162
155#undef FTRACE_ENTRY 163#undef FTRACE_ENTRY_REG
156#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print) \ 164#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, regfn)\
157 \ 165 \
158struct ftrace_event_class event_class_ftrace_##call = { \ 166struct ftrace_event_class event_class_ftrace_##call = { \
159 .system = __stringify(TRACE_SYSTEM), \ 167 .system = __stringify(TRACE_SYSTEM), \
160 .define_fields = ftrace_define_fields_##call, \ 168 .define_fields = ftrace_define_fields_##call, \
161 .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\ 169 .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\
170 .reg = regfn, \
162}; \ 171}; \
163 \ 172 \
164struct ftrace_event_call __used event_##call = { \ 173struct ftrace_event_call __used event_##call = { \
@@ -170,4 +179,9 @@ struct ftrace_event_call __used event_##call = { \
170struct ftrace_event_call __used \ 179struct ftrace_event_call __used \
171__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; 180__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
172 181
182#undef FTRACE_ENTRY
183#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print) \
184 FTRACE_ENTRY_REG(call, struct_name, etype, \
185 PARAMS(tstruct), PARAMS(print), NULL)
186
173#include "trace_entries.h" 187#include "trace_entries.h"