Commit e59a0bff authored by Jiri Olsa's avatar Jiri Olsa Committed by Steven Rostedt

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.comAcked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 489c75c3
...@@ -68,6 +68,10 @@ enum trace_type { ...@@ -68,6 +68,10 @@ enum trace_type {
#undef FTRACE_ENTRY_DUP #undef FTRACE_ENTRY_DUP
#define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk) #define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk)
#undef FTRACE_ENTRY_REG
#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \
FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
#include "trace_entries.h" #include "trace_entries.h"
/* /*
......
...@@ -18,6 +18,14 @@ ...@@ -18,6 +18,14 @@
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#define TRACE_SYSTEM ftrace #define TRACE_SYSTEM ftrace
/*
* The FTRACE_ENTRY_REG macro allows ftrace entry to define register
* function and thus become accesible via perf.
*/
#undef FTRACE_ENTRY_REG
#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, regfn) \
FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
/* not needed for this file */ /* not needed for this file */
#undef __field_struct #undef __field_struct
#define __field_struct(type, item) #define __field_struct(type, item)
...@@ -152,13 +160,14 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ ...@@ -152,13 +160,14 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
#undef F_printk #undef F_printk
#define F_printk(fmt, args...) #fmt ", " __stringify(args) #define F_printk(fmt, args...) #fmt ", " __stringify(args)
#undef FTRACE_ENTRY #undef FTRACE_ENTRY_REG
#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print) \ #define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, regfn)\
\ \
struct ftrace_event_class event_class_ftrace_##call = { \ struct ftrace_event_class event_class_ftrace_##call = { \
.system = __stringify(TRACE_SYSTEM), \ .system = __stringify(TRACE_SYSTEM), \
.define_fields = ftrace_define_fields_##call, \ .define_fields = ftrace_define_fields_##call, \
.fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\ .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\
.reg = regfn, \
}; \ }; \
\ \
struct ftrace_event_call __used event_##call = { \ struct ftrace_event_call __used event_##call = { \
...@@ -170,4 +179,9 @@ struct ftrace_event_call __used event_##call = { \ ...@@ -170,4 +179,9 @@ struct ftrace_event_call __used event_##call = { \
struct ftrace_event_call __used \ struct ftrace_event_call __used \
__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
#undef FTRACE_ENTRY
#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print) \
FTRACE_ENTRY_REG(call, struct_name, etype, \
PARAMS(tstruct), PARAMS(print), NULL)
#include "trace_entries.h" #include "trace_entries.h"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment