|
@@ -5,23 +5,23 @@
|
|
*
|
|
*
|
|
* static void ftrace_event_<call>(proto)
|
|
* static void ftrace_event_<call>(proto)
|
|
* {
|
|
* {
|
|
- * event_trace_printk(_RET_IP_, "<call>: " <fmt>);
|
|
|
|
|
|
+ * event_trace_printk(_RET_IP_, "<call>: " <fmt>);
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
* static int ftrace_reg_event_<call>(void)
|
|
* static int ftrace_reg_event_<call>(void)
|
|
* {
|
|
* {
|
|
- * int ret;
|
|
|
|
|
|
+ * 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;
|
|
|
|
|
|
+ * 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)
|
|
* static void ftrace_unreg_event_<call>(void)
|
|
* {
|
|
* {
|
|
- * unregister_trace_<call>(ftrace_event_<call>);
|
|
|
|
|
|
+ * unregister_trace_<call>(ftrace_event_<call>);
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
* For those macros defined with TRACE_FORMAT:
|
|
* For those macros defined with TRACE_FORMAT:
|
|
@@ -29,9 +29,9 @@
|
|
* static struct ftrace_event_call __used
|
|
* static struct ftrace_event_call __used
|
|
* __attribute__((__aligned__(4)))
|
|
* __attribute__((__aligned__(4)))
|
|
* __attribute__((section("_ftrace_events"))) event_<call> = {
|
|
* __attribute__((section("_ftrace_events"))) event_<call> = {
|
|
- * .name = "<call>",
|
|
|
|
- * .regfunc = ftrace_reg_event_<call>,
|
|
|
|
- * .unregfunc = ftrace_unreg_event_<call>,
|
|
|
|
|
|
+ * .name = "<call>",
|
|
|
|
+ * .regfunc = ftrace_reg_event_<call>,
|
|
|
|
+ * .unregfunc = ftrace_unreg_event_<call>,
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
*
|
|
*
|
|
@@ -41,66 +41,66 @@
|
|
*
|
|
*
|
|
* static void ftrace_raw_event_<call>(proto)
|
|
* static void ftrace_raw_event_<call>(proto)
|
|
* {
|
|
* {
|
|
- * struct ring_buffer_event *event;
|
|
|
|
- * struct ftrace_raw_<call> *entry; <-- defined in stage 1
|
|
|
|
- * unsigned long irq_flags;
|
|
|
|
- * int pc;
|
|
|
|
- *
|
|
|
|
- * local_save_flags(irq_flags);
|
|
|
|
- * pc = preempt_count();
|
|
|
|
- *
|
|
|
|
- * event = trace_current_buffer_lock_reserve(event_<call>.id,
|
|
|
|
- * sizeof(struct ftrace_raw_<call>),
|
|
|
|
- * irq_flags, pc);
|
|
|
|
- * if (!event)
|
|
|
|
- * return;
|
|
|
|
- * entry = ring_buffer_event_data(event);
|
|
|
|
- *
|
|
|
|
- * <assign>; <-- Here we assign the entries by the __field and
|
|
|
|
|
|
+ * struct ring_buffer_event *event;
|
|
|
|
+ * struct ftrace_raw_<call> *entry; <-- defined in stage 1
|
|
|
|
+ * unsigned long irq_flags;
|
|
|
|
+ * int pc;
|
|
|
|
+ *
|
|
|
|
+ * local_save_flags(irq_flags);
|
|
|
|
+ * pc = preempt_count();
|
|
|
|
+ *
|
|
|
|
+ * event = trace_current_buffer_lock_reserve(event_<call>.id,
|
|
|
|
+ * sizeof(struct ftrace_raw_<call>),
|
|
|
|
+ * irq_flags, pc);
|
|
|
|
+ * if (!event)
|
|
|
|
+ * return;
|
|
|
|
+ * entry = ring_buffer_event_data(event);
|
|
|
|
+ *
|
|
|
|
+ * <assign>; <-- Here we assign the entries by the __field and
|
|
* __array macros.
|
|
* __array macros.
|
|
*
|
|
*
|
|
- * trace_current_buffer_unlock_commit(event, irq_flags, pc);
|
|
|
|
|
|
+ * trace_current_buffer_unlock_commit(event, irq_flags, pc);
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
* static int ftrace_raw_reg_event_<call>(void)
|
|
* static int ftrace_raw_reg_event_<call>(void)
|
|
* {
|
|
* {
|
|
- * int ret;
|
|
|
|
|
|
+ * int ret;
|
|
*
|
|
*
|
|
- * ret = register_trace_<call>(ftrace_raw_event_<call>);
|
|
|
|
- * if (!ret)
|
|
|
|
- * pr_info("event trace: Could not activate trace point "
|
|
|
|
- * "probe to <call>");
|
|
|
|
- * return ret;
|
|
|
|
|
|
+ * ret = register_trace_<call>(ftrace_raw_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)
|
|
* static void ftrace_unreg_event_<call>(void)
|
|
* {
|
|
* {
|
|
- * unregister_trace_<call>(ftrace_raw_event_<call>);
|
|
|
|
|
|
+ * unregister_trace_<call>(ftrace_raw_event_<call>);
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
* static struct trace_event ftrace_event_type_<call> = {
|
|
* static struct trace_event ftrace_event_type_<call> = {
|
|
- * .trace = ftrace_raw_output_<call>, <-- stage 2
|
|
|
|
|
|
+ * .trace = ftrace_raw_output_<call>, <-- stage 2
|
|
* };
|
|
* };
|
|
*
|
|
*
|
|
* static int ftrace_raw_init_event_<call>(void)
|
|
* static int ftrace_raw_init_event_<call>(void)
|
|
* {
|
|
* {
|
|
- * int id;
|
|
|
|
|
|
+ * int id;
|
|
*
|
|
*
|
|
- * id = register_ftrace_event(&ftrace_event_type_<call>);
|
|
|
|
- * if (!id)
|
|
|
|
- * return -ENODEV;
|
|
|
|
- * event_<call>.id = id;
|
|
|
|
- * return 0;
|
|
|
|
|
|
+ * id = register_ftrace_event(&ftrace_event_type_<call>);
|
|
|
|
+ * if (!id)
|
|
|
|
+ * return -ENODEV;
|
|
|
|
+ * event_<call>.id = id;
|
|
|
|
+ * return 0;
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
* static struct ftrace_event_call __used
|
|
* static struct ftrace_event_call __used
|
|
* __attribute__((__aligned__(4)))
|
|
* __attribute__((__aligned__(4)))
|
|
* __attribute__((section("_ftrace_events"))) event_<call> = {
|
|
* __attribute__((section("_ftrace_events"))) event_<call> = {
|
|
- * .name = "<call>",
|
|
|
|
|
|
+ * .name = "<call>",
|
|
* .system = "<system>",
|
|
* .system = "<system>",
|
|
- * .raw_init = ftrace_raw_init_event_<call>,
|
|
|
|
- * .regfunc = ftrace_reg_event_<call>,
|
|
|
|
- * .unregfunc = ftrace_unreg_event_<call>,
|
|
|
|
|
|
+ * .raw_init = ftrace_raw_init_event_<call>,
|
|
|
|
+ * .regfunc = ftrace_reg_event_<call>,
|
|
|
|
+ * .unregfunc = ftrace_unreg_event_<call>,
|
|
* .show_format = ftrace_format_<call>,
|
|
* .show_format = ftrace_format_<call>,
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
@@ -138,7 +138,7 @@ _TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) \
|
|
static struct ftrace_event_call __used \
|
|
static struct ftrace_event_call __used \
|
|
__attribute__((__aligned__(4))) \
|
|
__attribute__((__aligned__(4))) \
|
|
__attribute__((section("_ftrace_events"))) event_##call = { \
|
|
__attribute__((section("_ftrace_events"))) event_##call = { \
|
|
- .name = #call, \
|
|
|
|
|
|
+ .name = #call, \
|
|
.system = __stringify(TRACE_SYSTEM), \
|
|
.system = __stringify(TRACE_SYSTEM), \
|
|
.regfunc = ftrace_reg_event_##call, \
|
|
.regfunc = ftrace_reg_event_##call, \
|
|
.unregfunc = ftrace_unreg_event_##call, \
|
|
.unregfunc = ftrace_unreg_event_##call, \
|
|
@@ -163,7 +163,7 @@ static void ftrace_raw_event_##call(proto) \
|
|
pc = preempt_count(); \
|
|
pc = preempt_count(); \
|
|
\
|
|
\
|
|
event = trace_current_buffer_lock_reserve(event_##call.id, \
|
|
event = trace_current_buffer_lock_reserve(event_##call.id, \
|
|
- sizeof(struct ftrace_raw_##call), \
|
|
|
|
|
|
+ sizeof(struct ftrace_raw_##call), \
|
|
irq_flags, pc); \
|
|
irq_flags, pc); \
|
|
if (!event) \
|
|
if (!event) \
|
|
return; \
|
|
return; \
|
|
@@ -208,7 +208,7 @@ static int ftrace_raw_init_event_##call(void) \
|
|
static struct ftrace_event_call __used \
|
|
static struct ftrace_event_call __used \
|
|
__attribute__((__aligned__(4))) \
|
|
__attribute__((__aligned__(4))) \
|
|
__attribute__((section("_ftrace_events"))) event_##call = { \
|
|
__attribute__((section("_ftrace_events"))) event_##call = { \
|
|
- .name = #call, \
|
|
|
|
|
|
+ .name = #call, \
|
|
.system = __stringify(TRACE_SYSTEM), \
|
|
.system = __stringify(TRACE_SYSTEM), \
|
|
.raw_init = ftrace_raw_init_event_##call, \
|
|
.raw_init = ftrace_raw_init_event_##call, \
|
|
.regfunc = ftrace_raw_reg_event_##call, \
|
|
.regfunc = ftrace_raw_reg_event_##call, \
|