Loading include/linux/tracepoint.h +104 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,110 @@ static inline void tracepoint_synchronize_unregister(void) #define TRACE_FORMAT(name, proto, args, fmt) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) #define TRACE_EVENT(name, proto, args, struct, print, assign) \ /* * For use with the TRACE_EVENT macro: * * We define a tracepoint, its arguments, its printk format * and its 'fast binay record' layout. * * Firstly, name your tracepoint via TRACE_EVENT(name : the * 'subsystem_event' notation is fine. * * Think about this whole construct as the * 'trace_sched_switch() function' from now on. * * * TRACE_EVENT(sched_switch, * * * * * A function has a regular function arguments * * prototype, declare it via TP_PROTO(): * * * * TP_PROTO(struct rq *rq, struct task_struct *prev, * struct task_struct *next), * * * * * Define the call signature of the 'function'. * * (Design sidenote: we use this instead of a * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.) * * * * TP_ARGS(rq, prev, next), * * * * * Fast binary tracing: define the trace record via * * TP_STRUCT__entry(). You can think about it like a * * regular C structure local variable definition. * * * * This is how the trace record is structured and will * * be saved into the ring buffer. These are the fields * * that will be exposed to user-space in * * /debug/tracing/events/<*>/format. * * * * The declared 'local variable' is called '__entry' * * * * __field(pid_t, prev_prid) is equivalent to a standard declariton: * * * * pid_t prev_pid; * * * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to: * * * * char prev_comm[TASK_COMM_LEN]; * * * * TP_STRUCT__entry( * __array( char, prev_comm, TASK_COMM_LEN ) * __field( pid_t, prev_pid ) * __field( int, prev_prio ) * __array( char, next_comm, TASK_COMM_LEN ) * __field( pid_t, next_pid ) * __field( int, next_prio ) * ), * * * * * Assign the entry into the trace record, by embedding * * a full C statement block into TP_fast_assign(). You * * can refer to the trace record as '__entry' - * * otherwise you can put arbitrary C code in here. * * * * Note: this C code will execute every time a trace event * * happens, on an active tracepoint. * * * * TP_fast_assign( * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); * __entry->prev_pid = prev->pid; * __entry->prev_prio = prev->prio; * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); * __entry->next_pid = next->pid; * __entry->next_prio = next->prio; * ) * * * * * Formatted output of a trace record via TP_printk(). * * This is how the tracepoint will appear under ftrace * * plugins that make use of this tracepoint. * * * * (raw-binary tracing wont actually perform this step.) * * * * TP_printk("task %s:%d [%d] ==> %s:%d [%d]", * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, * __entry->next_comm, __entry->next_pid, __entry->next_prio), * * ); * * This macro construct is thus used for the regular printk format * tracing setup, it is used to construct a function pointer based * tracepoint callback (this is used by programmatic plugins and * can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in * /debug/tracing/events/. */ #define TRACE_EVENT(name, proto, args, struct, assign, print) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) #endif include/trace/irq_event_types.h +4 −4 Original line number Diff line number Diff line Loading @@ -31,13 +31,13 @@ TRACE_EVENT(irq_handler_exit, __field( int, ret ) ), TP_printk("irq=%d return=%s", __entry->irq, __entry->ret ? "handled" : "unhandled"), TP_fast_assign( __entry->irq = irq; __entry->ret = ret; ) ), TP_printk("irq=%d return=%s", __entry->irq, __entry->ret ? "handled" : "unhandled") ); #undef TRACE_SYSTEM include/trace/sched_event_types.h +51 −51 Original line number Diff line number Diff line Loading @@ -22,12 +22,12 @@ TRACE_EVENT(sched_kthread_stop, __field( pid_t, pid ) ), TP_printk("task %s:%d", __entry->comm, __entry->pid), TP_fast_assign( memcpy(__entry->comm, t->comm, TASK_COMM_LEN); __entry->pid = t->pid; ) ), TP_printk("task %s:%d", __entry->comm, __entry->pid) ); /* Loading @@ -43,11 +43,11 @@ TRACE_EVENT(sched_kthread_stop_ret, __field( int, ret ) ), TP_printk("ret %d", __entry->ret), TP_fast_assign( __entry->ret = ret; ) ), TP_printk("ret %d", __entry->ret) ); /* Loading @@ -68,14 +68,14 @@ TRACE_EVENT(sched_wait_task, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -97,16 +97,16 @@ TRACE_EVENT(sched_wakeup, __field( int, success ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; __entry->success = success; ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success) ); /* Loading @@ -128,16 +128,16 @@ TRACE_EVENT(sched_wakeup_new, __field( int, success ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; __entry->success = success; ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success) ); /* Loading @@ -162,10 +162,6 @@ TRACE_EVENT(sched_switch, __field( int, next_prio ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; Loading @@ -173,7 +169,11 @@ TRACE_EVENT(sched_switch, memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio) ); /* Loading @@ -193,17 +193,17 @@ TRACE_EVENT(sched_migrate_task, __field( int, dest_cpu ) ), TP_printk("task %s:%d [%d] from: %d to: %d", __entry->comm, __entry->pid, __entry->prio, __entry->orig_cpu, __entry->dest_cpu), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; __entry->orig_cpu = orig_cpu; __entry->dest_cpu = dest_cpu; ) ), TP_printk("task %s:%d [%d] from: %d to: %d", __entry->comm, __entry->pid, __entry->prio, __entry->orig_cpu, __entry->dest_cpu) ); /* Loading @@ -221,14 +221,14 @@ TRACE_EVENT(sched_process_free, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -246,14 +246,14 @@ TRACE_EVENT(sched_process_exit, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -271,14 +271,14 @@ TRACE_EVENT(sched_process_wait, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, current->comm, TASK_COMM_LEN); __entry->pid = pid_nr(pid); __entry->prio = current->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -297,16 +297,16 @@ TRACE_EVENT(sched_process_fork, __field( pid_t, child_pid ) ), TP_printk("parent %s:%d child %s:%d", __entry->parent_comm, __entry->parent_pid, __entry->child_comm, __entry->child_pid), TP_fast_assign( memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); __entry->parent_pid = parent->pid; memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); __entry->child_pid = child->pid; ) ), TP_printk("parent %s:%d child %s:%d", __entry->parent_comm, __entry->parent_pid, __entry->child_comm, __entry->child_pid) ); /* Loading @@ -324,14 +324,14 @@ TRACE_EVENT(sched_signal_send, __field( pid_t, pid ) ), TP_printk("sig: %d task %s:%d", __entry->sig, __entry->comm, __entry->pid), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->sig = sig; ) ), TP_printk("sig: %d task %s:%d", __entry->sig, __entry->comm, __entry->pid) ); #undef TRACE_SYSTEM kernel/trace/trace_events.c +35 −10 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ static int ftrace_set_clr_event(char *buf, int set) mutex_lock(&event_mutex); events_for_each(call) { if (!call->name) if (!call->name || !call->regfunc) continue; if (match && Loading Loading @@ -207,9 +207,21 @@ t_next(struct seq_file *m, void *v, loff_t *pos) (*pos)++; for (;;) { if ((unsigned long)call >= (unsigned long)__stop_ftrace_events) return NULL; /* * The ftrace subsystem is for showing formats only. * They can not be enabled or disabled via the event files. */ if (call->regfunc) break; call++; next = call; } m->private = ++next; return call; Loading Loading @@ -338,8 +350,7 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, #undef FIELD #define FIELD(type, name) \ #type, #name, (unsigned int)offsetof(typeof(field), name), \ (unsigned int)sizeof(field.name) #type, #name, offsetof(typeof(field), name), sizeof(field.name) static int trace_write_header(struct trace_seq *s) { Loading @@ -347,11 +358,11 @@ static int trace_write_header(struct trace_seq *s) /* struct trace_entry */ return trace_seq_printf(s, "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\n", FIELD(unsigned char, type), FIELD(unsigned char, flags), Loading Loading @@ -417,6 +428,13 @@ static const struct seq_operations show_set_event_seq_ops = { .stop = t_stop, }; static const struct file_operations ftrace_avail_fops = { .open = ftrace_event_seq_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, }; static const struct file_operations ftrace_set_event_fops = { .open = ftrace_event_seq_open, .read = seq_read, Loading Loading @@ -558,6 +576,13 @@ static __init int event_trace_init(void) if (!d_tracer) return 0; entry = debugfs_create_file("available_events", 0444, d_tracer, (void *)&show_event_seq_ops, &ftrace_avail_fops); if (!entry) pr_warning("Could not create debugfs " "'available_events' entry\n"); entry = debugfs_create_file("set_event", 0644, d_tracer, (void *)&show_set_event_seq_ops, &ftrace_set_event_fops); Loading kernel/trace/trace_events_stage_1.h +5 −3 Original line number Diff line number Diff line Loading @@ -6,11 +6,13 @@ * struct ftrace_raw_<call> { * struct trace_entry ent; * <type> <item>; * <type2> <item2>[<len>]; * [...] * }; * * The <type> <item> is created by the TRACE_FIELD(type, item, assign) * macro. We simply do "type item;", and that will create the fields * The <type> <item> is created by the __field(type, item) macro or * the __array(type2, item2, len) macro. * We simply do "type item;", and that will create the fields * in the structure. */ Loading @@ -27,7 +29,7 @@ #define TP_STRUCT__entry(args...) args #undef TRACE_EVENT #define TRACE_EVENT(name, proto, args, tstruct, print, assign) \ #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ struct ftrace_raw_##name { \ struct trace_entry ent; \ tstruct \ Loading Loading
include/linux/tracepoint.h +104 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,110 @@ static inline void tracepoint_synchronize_unregister(void) #define TRACE_FORMAT(name, proto, args, fmt) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) #define TRACE_EVENT(name, proto, args, struct, print, assign) \ /* * For use with the TRACE_EVENT macro: * * We define a tracepoint, its arguments, its printk format * and its 'fast binay record' layout. * * Firstly, name your tracepoint via TRACE_EVENT(name : the * 'subsystem_event' notation is fine. * * Think about this whole construct as the * 'trace_sched_switch() function' from now on. * * * TRACE_EVENT(sched_switch, * * * * * A function has a regular function arguments * * prototype, declare it via TP_PROTO(): * * * * TP_PROTO(struct rq *rq, struct task_struct *prev, * struct task_struct *next), * * * * * Define the call signature of the 'function'. * * (Design sidenote: we use this instead of a * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.) * * * * TP_ARGS(rq, prev, next), * * * * * Fast binary tracing: define the trace record via * * TP_STRUCT__entry(). You can think about it like a * * regular C structure local variable definition. * * * * This is how the trace record is structured and will * * be saved into the ring buffer. These are the fields * * that will be exposed to user-space in * * /debug/tracing/events/<*>/format. * * * * The declared 'local variable' is called '__entry' * * * * __field(pid_t, prev_prid) is equivalent to a standard declariton: * * * * pid_t prev_pid; * * * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to: * * * * char prev_comm[TASK_COMM_LEN]; * * * * TP_STRUCT__entry( * __array( char, prev_comm, TASK_COMM_LEN ) * __field( pid_t, prev_pid ) * __field( int, prev_prio ) * __array( char, next_comm, TASK_COMM_LEN ) * __field( pid_t, next_pid ) * __field( int, next_prio ) * ), * * * * * Assign the entry into the trace record, by embedding * * a full C statement block into TP_fast_assign(). You * * can refer to the trace record as '__entry' - * * otherwise you can put arbitrary C code in here. * * * * Note: this C code will execute every time a trace event * * happens, on an active tracepoint. * * * * TP_fast_assign( * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); * __entry->prev_pid = prev->pid; * __entry->prev_prio = prev->prio; * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); * __entry->next_pid = next->pid; * __entry->next_prio = next->prio; * ) * * * * * Formatted output of a trace record via TP_printk(). * * This is how the tracepoint will appear under ftrace * * plugins that make use of this tracepoint. * * * * (raw-binary tracing wont actually perform this step.) * * * * TP_printk("task %s:%d [%d] ==> %s:%d [%d]", * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, * __entry->next_comm, __entry->next_pid, __entry->next_prio), * * ); * * This macro construct is thus used for the regular printk format * tracing setup, it is used to construct a function pointer based * tracepoint callback (this is used by programmatic plugins and * can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in * /debug/tracing/events/. */ #define TRACE_EVENT(name, proto, args, struct, assign, print) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) #endif
include/trace/irq_event_types.h +4 −4 Original line number Diff line number Diff line Loading @@ -31,13 +31,13 @@ TRACE_EVENT(irq_handler_exit, __field( int, ret ) ), TP_printk("irq=%d return=%s", __entry->irq, __entry->ret ? "handled" : "unhandled"), TP_fast_assign( __entry->irq = irq; __entry->ret = ret; ) ), TP_printk("irq=%d return=%s", __entry->irq, __entry->ret ? "handled" : "unhandled") ); #undef TRACE_SYSTEM
include/trace/sched_event_types.h +51 −51 Original line number Diff line number Diff line Loading @@ -22,12 +22,12 @@ TRACE_EVENT(sched_kthread_stop, __field( pid_t, pid ) ), TP_printk("task %s:%d", __entry->comm, __entry->pid), TP_fast_assign( memcpy(__entry->comm, t->comm, TASK_COMM_LEN); __entry->pid = t->pid; ) ), TP_printk("task %s:%d", __entry->comm, __entry->pid) ); /* Loading @@ -43,11 +43,11 @@ TRACE_EVENT(sched_kthread_stop_ret, __field( int, ret ) ), TP_printk("ret %d", __entry->ret), TP_fast_assign( __entry->ret = ret; ) ), TP_printk("ret %d", __entry->ret) ); /* Loading @@ -68,14 +68,14 @@ TRACE_EVENT(sched_wait_task, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -97,16 +97,16 @@ TRACE_EVENT(sched_wakeup, __field( int, success ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; __entry->success = success; ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success) ); /* Loading @@ -128,16 +128,16 @@ TRACE_EVENT(sched_wakeup_new, __field( int, success ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; __entry->success = success; ) ), TP_printk("task %s:%d [%d] success=%d", __entry->comm, __entry->pid, __entry->prio, __entry->success) ); /* Loading @@ -162,10 +162,6 @@ TRACE_EVENT(sched_switch, __field( int, next_prio ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio), TP_fast_assign( memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); __entry->prev_pid = prev->pid; Loading @@ -173,7 +169,11 @@ TRACE_EVENT(sched_switch, memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); __entry->next_pid = next->pid; __entry->next_prio = next->prio; ) ), TP_printk("task %s:%d [%d] ==> %s:%d [%d]", __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, __entry->next_comm, __entry->next_pid, __entry->next_prio) ); /* Loading @@ -193,17 +193,17 @@ TRACE_EVENT(sched_migrate_task, __field( int, dest_cpu ) ), TP_printk("task %s:%d [%d] from: %d to: %d", __entry->comm, __entry->pid, __entry->prio, __entry->orig_cpu, __entry->dest_cpu), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; __entry->orig_cpu = orig_cpu; __entry->dest_cpu = dest_cpu; ) ), TP_printk("task %s:%d [%d] from: %d to: %d", __entry->comm, __entry->pid, __entry->prio, __entry->orig_cpu, __entry->dest_cpu) ); /* Loading @@ -221,14 +221,14 @@ TRACE_EVENT(sched_process_free, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -246,14 +246,14 @@ TRACE_EVENT(sched_process_exit, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->prio = p->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -271,14 +271,14 @@ TRACE_EVENT(sched_process_wait, __field( int, prio ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio), TP_fast_assign( memcpy(__entry->comm, current->comm, TASK_COMM_LEN); __entry->pid = pid_nr(pid); __entry->prio = current->prio; ) ), TP_printk("task %s:%d [%d]", __entry->comm, __entry->pid, __entry->prio) ); /* Loading @@ -297,16 +297,16 @@ TRACE_EVENT(sched_process_fork, __field( pid_t, child_pid ) ), TP_printk("parent %s:%d child %s:%d", __entry->parent_comm, __entry->parent_pid, __entry->child_comm, __entry->child_pid), TP_fast_assign( memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); __entry->parent_pid = parent->pid; memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); __entry->child_pid = child->pid; ) ), TP_printk("parent %s:%d child %s:%d", __entry->parent_comm, __entry->parent_pid, __entry->child_comm, __entry->child_pid) ); /* Loading @@ -324,14 +324,14 @@ TRACE_EVENT(sched_signal_send, __field( pid_t, pid ) ), TP_printk("sig: %d task %s:%d", __entry->sig, __entry->comm, __entry->pid), TP_fast_assign( memcpy(__entry->comm, p->comm, TASK_COMM_LEN); __entry->pid = p->pid; __entry->sig = sig; ) ), TP_printk("sig: %d task %s:%d", __entry->sig, __entry->comm, __entry->pid) ); #undef TRACE_SYSTEM
kernel/trace/trace_events.c +35 −10 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ static int ftrace_set_clr_event(char *buf, int set) mutex_lock(&event_mutex); events_for_each(call) { if (!call->name) if (!call->name || !call->regfunc) continue; if (match && Loading Loading @@ -207,9 +207,21 @@ t_next(struct seq_file *m, void *v, loff_t *pos) (*pos)++; for (;;) { if ((unsigned long)call >= (unsigned long)__stop_ftrace_events) return NULL; /* * The ftrace subsystem is for showing formats only. * They can not be enabled or disabled via the event files. */ if (call->regfunc) break; call++; next = call; } m->private = ++next; return call; Loading Loading @@ -338,8 +350,7 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, #undef FIELD #define FIELD(type, name) \ #type, #name, (unsigned int)offsetof(typeof(field), name), \ (unsigned int)sizeof(field.name) #type, #name, offsetof(typeof(field), name), sizeof(field.name) static int trace_write_header(struct trace_seq *s) { Loading @@ -347,11 +358,11 @@ static int trace_write_header(struct trace_seq *s) /* struct trace_entry */ return trace_seq_printf(s, "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n" "\n", FIELD(unsigned char, type), FIELD(unsigned char, flags), Loading Loading @@ -417,6 +428,13 @@ static const struct seq_operations show_set_event_seq_ops = { .stop = t_stop, }; static const struct file_operations ftrace_avail_fops = { .open = ftrace_event_seq_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, }; static const struct file_operations ftrace_set_event_fops = { .open = ftrace_event_seq_open, .read = seq_read, Loading Loading @@ -558,6 +576,13 @@ static __init int event_trace_init(void) if (!d_tracer) return 0; entry = debugfs_create_file("available_events", 0444, d_tracer, (void *)&show_event_seq_ops, &ftrace_avail_fops); if (!entry) pr_warning("Could not create debugfs " "'available_events' entry\n"); entry = debugfs_create_file("set_event", 0644, d_tracer, (void *)&show_set_event_seq_ops, &ftrace_set_event_fops); Loading
kernel/trace/trace_events_stage_1.h +5 −3 Original line number Diff line number Diff line Loading @@ -6,11 +6,13 @@ * struct ftrace_raw_<call> { * struct trace_entry ent; * <type> <item>; * <type2> <item2>[<len>]; * [...] * }; * * The <type> <item> is created by the TRACE_FIELD(type, item, assign) * macro. We simply do "type item;", and that will create the fields * The <type> <item> is created by the __field(type, item) macro or * the __array(type2, item2, len) macro. * We simply do "type item;", and that will create the fields * in the structure. */ Loading @@ -27,7 +29,7 @@ #define TP_STRUCT__entry(args...) args #undef TRACE_EVENT #define TRACE_EVENT(name, proto, args, tstruct, print, assign) \ #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ struct ftrace_raw_##name { \ struct trace_entry ent; \ tstruct \ Loading