Commit 9a1043d1 authored by Ingo Molnar's avatar Ingo Molnar

Merge branch 'tip/tracing/ftrace' of...

Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
parents 12e87e36 157587d7
...@@ -45,8 +45,8 @@ In include/trace/subsys.h : ...@@ -45,8 +45,8 @@ In include/trace/subsys.h :
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
DECLARE_TRACE(subsys_eventname, DECLARE_TRACE(subsys_eventname,
TPPROTO(int firstarg, struct task_struct *p), TP_PROTO(int firstarg, struct task_struct *p),
TPARGS(firstarg, p)); TP_ARGS(firstarg, p));
In subsys/file.c (where the tracing statement must be added) : In subsys/file.c (where the tracing statement must be added) :
...@@ -66,10 +66,10 @@ Where : ...@@ -66,10 +66,10 @@ Where :
- subsys is the name of your subsystem. - subsys is the name of your subsystem.
- eventname is the name of the event to trace. - eventname is the name of the event to trace.
- TPPROTO(int firstarg, struct task_struct *p) is the prototype of the - TP_PROTO(int firstarg, struct task_struct *p) is the prototype of the
function called by this tracepoint. function called by this tracepoint.
- TPARGS(firstarg, p) are the parameters names, same as found in the - TP_ARGS(firstarg, p) are the parameters names, same as found in the
prototype. prototype.
Connecting a function (probe) to a tracepoint is done by providing a Connecting a function (probe) to a tracepoint is done by providing a
......
...@@ -31,8 +31,8 @@ struct tracepoint { ...@@ -31,8 +31,8 @@ struct tracepoint {
* Keep in sync with vmlinux.lds.h. * Keep in sync with vmlinux.lds.h.
*/ */
#define TPPROTO(args...) args #define TP_PROTO(args...) args
#define TPARGS(args...) args #define TP_ARGS(args...) args
#ifdef CONFIG_TRACEPOINTS #ifdef CONFIG_TRACEPOINTS
...@@ -65,7 +65,7 @@ struct tracepoint { ...@@ -65,7 +65,7 @@ struct tracepoint {
{ \ { \
if (unlikely(__tracepoint_##name.state)) \ if (unlikely(__tracepoint_##name.state)) \
__DO_TRACE(&__tracepoint_##name, \ __DO_TRACE(&__tracepoint_##name, \
TPPROTO(proto), TPARGS(args)); \ TP_PROTO(proto), TP_ARGS(args)); \
} \ } \
static inline int register_trace_##name(void (*probe)(proto)) \ static inline int register_trace_##name(void (*probe)(proto)) \
{ \ { \
...@@ -157,7 +157,7 @@ static inline void tracepoint_synchronize_unregister(void) ...@@ -157,7 +157,7 @@ static inline void tracepoint_synchronize_unregister(void)
#define TRACE_FORMAT(name, proto, args, fmt) \ #define TRACE_FORMAT(name, proto, args, fmt) \
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#define TRACE_EVENT_FORMAT(name, proto, args, fmt, struct, tpfmt) \ #define TRACE_EVENT(name, proto, args, struct, print, assign) \
TRACE_FORMAT(name, PARAMS(proto), PARAMS(args), PARAMS(fmt)) DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
#endif #endif
...@@ -5,72 +5,72 @@ ...@@ -5,72 +5,72 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
DECLARE_TRACE(block_rq_abort, DECLARE_TRACE(block_rq_abort,
TPPROTO(struct request_queue *q, struct request *rq), TP_PROTO(struct request_queue *q, struct request *rq),
TPARGS(q, rq)); TP_ARGS(q, rq));
DECLARE_TRACE(block_rq_insert, DECLARE_TRACE(block_rq_insert,
TPPROTO(struct request_queue *q, struct request *rq), TP_PROTO(struct request_queue *q, struct request *rq),
TPARGS(q, rq)); TP_ARGS(q, rq));
DECLARE_TRACE(block_rq_issue, DECLARE_TRACE(block_rq_issue,
TPPROTO(struct request_queue *q, struct request *rq), TP_PROTO(struct request_queue *q, struct request *rq),
TPARGS(q, rq)); TP_ARGS(q, rq));
DECLARE_TRACE(block_rq_requeue, DECLARE_TRACE(block_rq_requeue,
TPPROTO(struct request_queue *q, struct request *rq), TP_PROTO(struct request_queue *q, struct request *rq),
TPARGS(q, rq)); TP_ARGS(q, rq));
DECLARE_TRACE(block_rq_complete, DECLARE_TRACE(block_rq_complete,
TPPROTO(struct request_queue *q, struct request *rq), TP_PROTO(struct request_queue *q, struct request *rq),
TPARGS(q, rq)); TP_ARGS(q, rq));
DECLARE_TRACE(block_bio_bounce, DECLARE_TRACE(block_bio_bounce,
TPPROTO(struct request_queue *q, struct bio *bio), TP_PROTO(struct request_queue *q, struct bio *bio),
TPARGS(q, bio)); TP_ARGS(q, bio));
DECLARE_TRACE(block_bio_complete, DECLARE_TRACE(block_bio_complete,
TPPROTO(struct request_queue *q, struct bio *bio), TP_PROTO(struct request_queue *q, struct bio *bio),
TPARGS(q, bio)); TP_ARGS(q, bio));
DECLARE_TRACE(block_bio_backmerge, DECLARE_TRACE(block_bio_backmerge,
TPPROTO(struct request_queue *q, struct bio *bio), TP_PROTO(struct request_queue *q, struct bio *bio),
TPARGS(q, bio)); TP_ARGS(q, bio));
DECLARE_TRACE(block_bio_frontmerge, DECLARE_TRACE(block_bio_frontmerge,
TPPROTO(struct request_queue *q, struct bio *bio), TP_PROTO(struct request_queue *q, struct bio *bio),
TPARGS(q, bio)); TP_ARGS(q, bio));
DECLARE_TRACE(block_bio_queue, DECLARE_TRACE(block_bio_queue,
TPPROTO(struct request_queue *q, struct bio *bio), TP_PROTO(struct request_queue *q, struct bio *bio),
TPARGS(q, bio)); TP_ARGS(q, bio));
DECLARE_TRACE(block_getrq, DECLARE_TRACE(block_getrq,
TPPROTO(struct request_queue *q, struct bio *bio, int rw), TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
TPARGS(q, bio, rw)); TP_ARGS(q, bio, rw));
DECLARE_TRACE(block_sleeprq, DECLARE_TRACE(block_sleeprq,
TPPROTO(struct request_queue *q, struct bio *bio, int rw), TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
TPARGS(q, bio, rw)); TP_ARGS(q, bio, rw));
DECLARE_TRACE(block_plug, DECLARE_TRACE(block_plug,
TPPROTO(struct request_queue *q), TP_PROTO(struct request_queue *q),
TPARGS(q)); TP_ARGS(q));
DECLARE_TRACE(block_unplug_timer, DECLARE_TRACE(block_unplug_timer,
TPPROTO(struct request_queue *q), TP_PROTO(struct request_queue *q),
TPARGS(q)); TP_ARGS(q));
DECLARE_TRACE(block_unplug_io, DECLARE_TRACE(block_unplug_io,
TPPROTO(struct request_queue *q), TP_PROTO(struct request_queue *q),
TPARGS(q)); TP_ARGS(q));
DECLARE_TRACE(block_split, DECLARE_TRACE(block_split,
TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), TP_PROTO(struct request_queue *q, struct bio *bio, unsigned int pdu),
TPARGS(q, bio, pdu)); TP_ARGS(q, bio, pdu));
DECLARE_TRACE(block_remap, DECLARE_TRACE(block_remap,
TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev, TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
sector_t from, sector_t to), sector_t from, sector_t to),
TPARGS(q, bio, dev, from, to)); TP_ARGS(q, bio, dev, from, to));
#endif #endif
...@@ -8,26 +8,36 @@ ...@@ -8,26 +8,36 @@
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#define TRACE_SYSTEM irq #define TRACE_SYSTEM irq
TRACE_EVENT_FORMAT(irq_handler_entry, /*
TPPROTO(int irq, struct irqaction *action), * Tracepoint for entry of interrupt handler:
TPARGS(irq, action), */
TPFMT("irq=%d handler=%s", irq, action->name), TRACE_FORMAT(irq_handler_entry,
TRACE_STRUCT( TP_PROTO(int irq, struct irqaction *action),
TRACE_FIELD(int, irq, irq) TP_ARGS(irq, action),
), TP_FMT("irq=%d handler=%s", irq, action->name)
TPRAWFMT("irq %d")
); );
TRACE_EVENT_FORMAT(irq_handler_exit, /*
TPPROTO(int irq, struct irqaction *action, int ret), * Tracepoint for return of an interrupt handler:
TPARGS(irq, action, ret), */
TPFMT("irq=%d handler=%s return=%s", TRACE_EVENT(irq_handler_exit,
irq, action->name, ret ? "handled" : "unhandled"),
TRACE_STRUCT( TP_PROTO(int irq, struct irqaction *action, int ret),
TRACE_FIELD(int, irq, irq)
TRACE_FIELD(int, ret, ret) TP_ARGS(irq, action, ret),
TP_STRUCT__entry(
__field( int, irq )
__field( int, ret )
), ),
TPRAWFMT("irq %d ret %d")
); TP_printk("irq=%d return=%s",
__entry->irq, __entry->ret ? "handled" : "unhandled"),
TP_fast_assign(
__entry->irq = irq;
__entry->ret = ret;
)
);
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#ifndef TRACE_EVENT_FORMAT #ifndef TRACE_FORMAT
# error Do not include this file directly. # error Do not include this file directly.
# error Unless you know what you are doing. # error Unless you know what you are doing.
#endif #endif
...@@ -10,32 +10,32 @@ ...@@ -10,32 +10,32 @@
#ifdef CONFIG_LOCKDEP #ifdef CONFIG_LOCKDEP
TRACE_FORMAT(lock_acquire, TRACE_FORMAT(lock_acquire,
TPPROTO(struct lockdep_map *lock, unsigned int subclass, TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
int trylock, int read, int check, int trylock, int read, int check,
struct lockdep_map *next_lock, unsigned long ip), struct lockdep_map *next_lock, unsigned long ip),
TPARGS(lock, subclass, trylock, read, check, next_lock, ip), TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
TPFMT("%s%s%s", trylock ? "try " : "", TP_FMT("%s%s%s", trylock ? "try " : "",
read ? "read " : "", lock->name) read ? "read " : "", lock->name)
); );
TRACE_FORMAT(lock_release, TRACE_FORMAT(lock_release,
TPPROTO(struct lockdep_map *lock, int nested, unsigned long ip), TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
TPARGS(lock, nested, ip), TP_ARGS(lock, nested, ip),
TPFMT("%s", lock->name) TP_FMT("%s", lock->name)
); );
#ifdef CONFIG_LOCK_STAT #ifdef CONFIG_LOCK_STAT
TRACE_FORMAT(lock_contended, TRACE_FORMAT(lock_contended,
TPPROTO(struct lockdep_map *lock, unsigned long ip), TP_PROTO(struct lockdep_map *lock, unsigned long ip),
TPARGS(lock, ip), TP_ARGS(lock, ip),
TPFMT("%s", lock->name) TP_FMT("%s", lock->name)
); );
TRACE_FORMAT(lock_acquired, TRACE_FORMAT(lock_acquired,
TPPROTO(struct lockdep_map *lock, unsigned long ip), TP_PROTO(struct lockdep_map *lock, unsigned long ip),
TPARGS(lock, ip), TP_ARGS(lock, ip),
TPFMT("%s", lock->name) TP_FMT("%s", lock->name)
); );
#endif #endif
......
...@@ -18,15 +18,15 @@ struct power_trace { ...@@ -18,15 +18,15 @@ struct power_trace {
}; };
DECLARE_TRACE(power_start, DECLARE_TRACE(power_start,
TPPROTO(struct power_trace *it, unsigned int type, unsigned int state), TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
TPARGS(it, type, state)); TP_ARGS(it, type, state));
DECLARE_TRACE(power_mark, DECLARE_TRACE(power_mark,
TPPROTO(struct power_trace *it, unsigned int type, unsigned int state), TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
TPARGS(it, type, state)); TP_ARGS(it, type, state));
DECLARE_TRACE(power_end, DECLARE_TRACE(power_end,
TPPROTO(struct power_trace *it), TP_PROTO(struct power_trace *it),
TPARGS(it)); TP_ARGS(it));
#endif /* _TRACE_POWER_H */ #endif /* _TRACE_POWER_H */
This diff is collapsed.
...@@ -6,20 +6,20 @@ ...@@ -6,20 +6,20 @@
#include <linux/sched.h> #include <linux/sched.h>
DECLARE_TRACE(workqueue_insertion, DECLARE_TRACE(workqueue_insertion,
TPPROTO(struct task_struct *wq_thread, struct work_struct *work), TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
TPARGS(wq_thread, work)); TP_ARGS(wq_thread, work));
DECLARE_TRACE(workqueue_execution, DECLARE_TRACE(workqueue_execution,
TPPROTO(struct task_struct *wq_thread, struct work_struct *work), TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
TPARGS(wq_thread, work)); TP_ARGS(wq_thread, work));
/* Trace the creation of one workqueue thread on a cpu */ /* Trace the creation of one workqueue thread on a cpu */
DECLARE_TRACE(workqueue_creation, DECLARE_TRACE(workqueue_creation,
TPPROTO(struct task_struct *wq_thread, int cpu), TP_PROTO(struct task_struct *wq_thread, int cpu),
TPARGS(wq_thread, cpu)); TP_ARGS(wq_thread, cpu));
DECLARE_TRACE(workqueue_destruction, DECLARE_TRACE(workqueue_destruction,
TPPROTO(struct task_struct *wq_thread), TP_PROTO(struct task_struct *wq_thread),
TPARGS(wq_thread)); TP_ARGS(wq_thread));
#endif /* __TRACE_WORKQUEUE_H */ #endif /* __TRACE_WORKQUEUE_H */
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
* This is the place to register all trace points as events. * This is the place to register all trace points as events.
*/ */
/* someday this needs to go in a generic header */ #include <linux/stringify.h>
#define __STR(x) #x
#define STR(x) __STR(x)
#include <trace/trace_events.h> #include <trace/trace_events.h>
......
...@@ -751,12 +751,7 @@ struct ftrace_event_call { ...@@ -751,12 +751,7 @@ struct ftrace_event_call {
int (*regfunc)(void); int (*regfunc)(void);
void (*unregfunc)(void); void (*unregfunc)(void);
int id; int id;
struct dentry *raw_dir;
int raw_enabled;
int type;
int (*raw_init)(void); int (*raw_init)(void);
int (*raw_reg)(void);
void (*raw_unreg)(void);
int (*show_format)(struct trace_seq *s); int (*show_format)(struct trace_seq *s);
}; };
......
...@@ -10,7 +10,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore, ...@@ -10,7 +10,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
TRACE_FIELD(unsigned long, ip, ip) TRACE_FIELD(unsigned long, ip, ip)
TRACE_FIELD(unsigned long, parent_ip, parent_ip) TRACE_FIELD(unsigned long, parent_ip, parent_ip)
), ),
TPRAWFMT(" %lx <-- %lx") TP_RAW_FMT(" %lx <-- %lx")
); );
TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT, TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
...@@ -19,7 +19,7 @@ TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT, ...@@ -19,7 +19,7 @@ TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
TRACE_FIELD(unsigned long, graph_ent.func, func) TRACE_FIELD(unsigned long, graph_ent.func, func)
TRACE_FIELD(int, graph_ent.depth, depth) TRACE_FIELD(int, graph_ent.depth, depth)
), ),
TPRAWFMT("--> %lx (%d)") TP_RAW_FMT("--> %lx (%d)")
); );
TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET, TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
...@@ -28,7 +28,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET, ...@@ -28,7 +28,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
TRACE_FIELD(unsigned long, ret.func, func) TRACE_FIELD(unsigned long, ret.func, func)
TRACE_FIELD(int, ret.depth, depth) TRACE_FIELD(int, ret.depth, depth)
), ),
TPRAWFMT("<-- %lx (%d)") TP_RAW_FMT("<-- %lx (%d)")
); );
TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore, TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
...@@ -41,7 +41,7 @@ TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore, ...@@ -41,7 +41,7 @@ TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
TRACE_FIELD(unsigned char, next_state, next_state) TRACE_FIELD(unsigned char, next_state, next_state)
TRACE_FIELD(unsigned int, next_cpu, next_cpu) TRACE_FIELD(unsigned int, next_cpu, next_cpu)
), ),
TPRAWFMT("%u:%u:%u ==+ %u:%u:%u [%03u]") TP_RAW_FMT("%u:%u:%u ==+ %u:%u:%u [%03u]")
); );
TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore, TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore,
...@@ -54,7 +54,7 @@ TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore, ...@@ -54,7 +54,7 @@ TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore,
TRACE_FIELD(unsigned char, next_state, next_state) TRACE_FIELD(unsigned char, next_state, next_state)
TRACE_FIELD(unsigned int, next_cpu, next_cpu) TRACE_FIELD(unsigned int, next_cpu, next_cpu)
), ),
TPRAWFMT("%u:%u:%u ==+ %u:%u:%u [%03u]") TP_RAW_FMT("%u:%u:%u ==+ %u:%u:%u [%03u]")
); );
TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore, TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore,
...@@ -63,7 +63,7 @@ TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore, ...@@ -63,7 +63,7 @@ TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore,
TRACE_FIELD(unsigned long, arg2, arg2) TRACE_FIELD(unsigned long, arg2, arg2)
TRACE_FIELD(unsigned long, arg3, arg3) TRACE_FIELD(unsigned long, arg3, arg3)
), ),
TPRAWFMT("(%08lx) (%08lx) (%08lx)") TP_RAW_FMT("(%08lx) (%08lx) (%08lx)")
); );
/* /*
...@@ -83,7 +83,7 @@ TRACE_EVENT_FORMAT(kernel_stack, TRACE_STACK, stack_entry, ignore, ...@@ -83,7 +83,7 @@ TRACE_EVENT_FORMAT(kernel_stack, TRACE_STACK, stack_entry, ignore,
TRACE_FIELD(unsigned long, caller[6], stack6) TRACE_FIELD(unsigned long, caller[6], stack6)
TRACE_FIELD(unsigned long, caller[7], stack7) TRACE_FIELD(unsigned long, caller[7], stack7)
), ),
TPRAWFMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
"\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n") "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
); );
...@@ -98,7 +98,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore, ...@@ -98,7 +98,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore,
TRACE_FIELD(unsigned long, caller[6], stack6) TRACE_FIELD(unsigned long, caller[6], stack6)
TRACE_FIELD(unsigned long, caller[7], stack7) TRACE_FIELD(unsigned long, caller[7], stack7)
), ),
TPRAWFMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
"\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n") "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
); );
...@@ -106,9 +106,10 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore, ...@@ -106,9 +106,10 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
TRACE_STRUCT( TRACE_STRUCT(
TRACE_FIELD(unsigned long, ip, ip) TRACE_FIELD(unsigned long, ip, ip)
TRACE_FIELD(unsigned int, depth, depth) TRACE_FIELD(unsigned int, depth, depth)
TRACE_FIELD(char *, fmt, fmt)
TRACE_FIELD_ZERO_CHAR(buf) TRACE_FIELD_ZERO_CHAR(buf)
), ),
TPRAWFMT("%08lx (%d) %s") TP_RAW_FMT("%08lx (%d) fmt:%p %s")
); );
TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore, TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
...@@ -118,7 +119,7 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore, ...@@ -118,7 +119,7 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
TRACE_FIELD_SPECIAL(char file[TRACE_FUNC_SIZE+1], file, file) TRACE_FIELD_SPECIAL(char file[TRACE_FUNC_SIZE+1], file, file)
TRACE_FIELD(char, correct, correct) TRACE_FIELD(char, correct, correct)
), ),
TPRAWFMT("%u:%s:%s (%u)") TP_RAW_FMT("%u:%s:%s (%u)")
); );
TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore, TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
...@@ -126,7 +127,7 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore, ...@@ -126,7 +127,7 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
TRACE_FIELD(u64, from, from) TRACE_FIELD(u64, from, from)
TRACE_FIELD(u64, to, to) TRACE_FIELD(u64, to, to)
), ),
TPRAWFMT("from: %llx to: %llx") TP_RAW_FMT("from: %llx to: %llx")
); );
TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore, TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
...@@ -136,7 +137,7 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore, ...@@ -136,7 +137,7 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
TRACE_FIELD(int, state_data.type, type) TRACE_FIELD(int, state_data.type, type)
TRACE_FIELD(int, state_data.state, state) TRACE_FIELD(int, state_data.state, state)
), ),
TPRAWFMT("%llx->%llx type:%u state:%u") TP_RAW_FMT("%llx->%llx type:%u state:%u")
); );
TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore, TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
...@@ -149,7 +150,7 @@ TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore, ...@@ -149,7 +150,7 @@ TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
TRACE_FIELD(gfp_t, gfp_flags, gfp_flags) TRACE_FIELD(gfp_t, gfp_flags, gfp_flags)
TRACE_FIELD(int, node, node) TRACE_FIELD(int, node, node)
), ),
TPRAWFMT("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu" TP_RAW_FMT("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu"
" flags:%x node:%d") " flags:%x node:%d")
); );
...@@ -159,7 +160,7 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore, ...@@ -159,7 +160,7 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore,
TRACE_FIELD(unsigned long, call_site, call_site) TRACE_FIELD(unsigned long, call_site, call_site)
TRACE_FIELD(const void *, ptr, ptr) TRACE_FIELD(const void *, ptr, ptr)
), ),
TPRAWFMT("type:%u call_site:%lx ptr:%p") TP_RAW_FMT("type:%u call_site:%lx ptr:%p")
); );
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
...@@ -59,22 +59,12 @@ static void ftrace_event_enable_disable(struct ftrace_event_call *call, ...@@ -59,22 +59,12 @@ static void ftrace_event_enable_disable(struct ftrace_event_call *call,
call->enabled = 0; call->enabled = 0;
call->unregfunc(); call->unregfunc();
} }
if (call->raw_enabled) {
call->raw_enabled = 0;
call->raw_unreg();
}
break; break;
case 1: case 1:
if (!call->enabled && if (!call->enabled) {
(call->type & TRACE_EVENT_TYPE_PRINTF)) {
call->enabled = 1; call->enabled = 1;
call->regfunc(); call->regfunc();
} }
if (!call->raw_enabled &&
(call->type & TRACE_EVENT_TYPE_RAW)) {
call->raw_enabled = 1;
call->raw_reg();
}
break; break;
} }
} }
...@@ -300,7 +290,7 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt, ...@@ -300,7 +290,7 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
struct ftrace_event_call *call = filp->private_data; struct ftrace_event_call *call = filp->private_data;
char *buf; char *buf;
if (call->enabled || call->raw_enabled) if (call->enabled)
buf = "1\n"; buf = "1\n";
else else
buf = "0\n"; buf = "0\n";
...@@ -346,110 +336,10 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, ...@@ -346,110 +336,10 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
return cnt; return cnt;
} }
static ssize_t
event_type_read(struct file *filp, char __user *ubuf, size_t cnt,
loff_t *ppos)
{
struct ftrace_event_call *call = filp->private_data;
char buf[16];
int r = 0;
if (call->type & TRACE_EVENT_TYPE_PRINTF)
r += sprintf(buf, "printf\n");
if (call->type & TRACE_EVENT_TYPE_RAW)
r += sprintf(buf+r, "raw\n");
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
}
static ssize_t
event_type_write(struct file *filp, const char __user *ubuf, size_t cnt,
loff_t *ppos)
{
struct ftrace_event_call *call = filp->private_data;
char buf[64];
/*
* If there's only one type, we can't change it.
* And currently we always have printf type, and we
* may or may not have raw type.
*
* This is a redundant check, the file should be read
* only if this is the case anyway.
*/
if (!call->raw_init)
return -EPERM;
if (cnt >= sizeof(buf))
return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT;
buf[cnt] = 0;
if (!strncmp(buf, "printf", 6) &&
(!buf[6] || isspace(buf[6]))) {
call->type = TRACE_EVENT_TYPE_PRINTF;
/*
* If raw enabled, the disable it and enable
* printf type.
*/
if (call->raw_enabled) {
call->raw_enabled = 0;
call->raw_unreg();
call->enabled = 1;
call->regfunc();
}
} else if (!strncmp(buf, "raw", 3) &&
(!buf[3] || isspace(buf[3]))) {
call->type = TRACE_EVENT_TYPE_RAW;
/*
* If printf enabled, the disable it and enable
* raw type.
*/
if (call->enabled) {
call->enabled = 0;
call->unregfunc();
call->raw_enabled = 1;
call->raw_reg();
}
} else
return -EINVAL;
*ppos += cnt;
return cnt;
}
static ssize_t
event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt,
loff_t *ppos)
{
struct ftrace_event_call *call = filp->private_data;
char buf[16];
int r = 0;
r += sprintf(buf, "printf\n");
if (call->raw_init)
r += sprintf(buf+r, "raw\n");
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
}
#undef FIELD #undef FIELD
#define FIELD(type, name) \ #define FIELD(type, name) \
#type, #name, offsetof(typeof(field), name), sizeof(field.name) #type, #name, (unsigned int)offsetof(typeof(field), name), \
(unsigned int)sizeof(field.name)
static int trace_write_header(struct trace_seq *s) static int trace_write_header(struct trace_seq *s)
{ {
...@@ -457,11 +347,11 @@ static int trace_write_header(struct trace_seq *s) ...@@ -457,11 +347,11 @@ static int trace_write_header(struct trace_seq *s)
/* struct trace_entry */ /* struct trace_entry */
return trace_seq_printf(s, return trace_seq_printf(s,
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
"\n", "\n",
FIELD(unsigned char, type), FIELD(unsigned char, type),
FIELD(unsigned char, flags), FIELD(unsigned char, flags),
...@@ -469,6 +359,7 @@ static int trace_write_header(struct trace_seq *s) ...@@ -469,6 +359,7 @@ static int trace_write_header(struct trace_seq *s)
FIELD(int, pid), FIELD(int, pid),
FIELD(int, tgid)); FIELD(int, tgid));
} }
static ssize_t static ssize_t
event_format_read(struct file *filp, char __user *ubuf, size_t cnt, event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
loff_t *ppos) loff_t *ppos)
...@@ -526,13 +417,6 @@ static const struct seq_operations show_set_event_seq_ops = { ...@@ -526,13 +417,6 @@ static const struct seq_operations show_set_event_seq_ops = {
.stop = t_stop, .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 = { static const struct file_operations ftrace_set_event_fops = {
.open = ftrace_event_seq_open, .open = ftrace_event_seq_open,
.read = seq_read, .read = seq_read,
...@@ -547,17 +431,6 @@ static const struct file_operations ftrace_enable_fops = { ...@@ -547,17 +431,6 @@ static const struct file_operations ftrace_enable_fops = {
.write = event_enable_write, .write = event_enable_write,
}; };
static const struct file_operations ftrace_type_fops = {
.open = tracing_open_generic,
.read = event_type_read,
.write = event_type_write,
};
static const struct file_operations ftrace_available_types_fops = {
.open = tracing_open_generic,
.read = event_available_types_read,
};
static const struct file_operations ftrace_event_format_fops = { static const struct file_operations ftrace_event_format_fops = {
.open = tracing_open_generic, .open = tracing_open_generic,
.read = event_format_read, .read = event_format_read,
...@@ -646,9 +519,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events) ...@@ -646,9 +519,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
} }
} }
/* default the output to printf */
call->type = TRACE_EVENT_TYPE_PRINTF;
call->dir = debugfs_create_dir(call->name, d_events); call->dir = debugfs_create_dir(call->name, d_events);
if (!call->dir) { if (!call->dir) {
pr_warning("Could not create debugfs " pr_warning("Could not create debugfs "
...@@ -664,21 +534,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events) ...@@ -664,21 +534,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
"'%s/enable' entry\n", call->name); "'%s/enable' entry\n", call->name);
} }
/* Only let type be writable, if we can change it */
entry = debugfs_create_file("type",
call->raw_init ? 0644 : 0444,
call->dir, call,
&ftrace_type_fops);
if (!entry)
pr_warning("Could not create debugfs "
"'%s/type' entry\n", call->name);
entry = debugfs_create_file("available_types", 0444, call->dir, call,
&ftrace_available_types_fops);
if (!entry)
pr_warning("Could not create debugfs "
"'%s/available_types' entry\n", call->name);
/* A trace may not want to export its format */ /* A trace may not want to export its format */
if (!call->show_format) if (!call->show_format)
return 0; return 0;
...@@ -703,13 +558,6 @@ static __init int event_trace_init(void) ...@@ -703,13 +558,6 @@ static __init int event_trace_init(void)
if (!d_tracer) if (!d_tracer)
return 0; 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, entry = debugfs_create_file("set_event", 0644, d_tracer,
(void *)&show_set_event_seq_ops, (void *)&show_set_event_seq_ops,
&ftrace_set_event_fops); &ftrace_set_event_fops);
......
...@@ -17,20 +17,21 @@ ...@@ -17,20 +17,21 @@
#undef TRACE_FORMAT #undef TRACE_FORMAT
#define TRACE_FORMAT(call, proto, args, fmt) #define TRACE_FORMAT(call, proto, args, fmt)
#undef TRACE_EVENT_FORMAT #undef __array
#define TRACE_EVENT_FORMAT(name, proto, args, fmt, tstruct, tpfmt) \ #define __array(type, item, len) type item[len];
#undef __field
#define __field(type, item) type item;
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args
#undef TRACE_EVENT
#define TRACE_EVENT(name, proto, args, tstruct, print, assign) \
struct ftrace_raw_##name { \ struct ftrace_raw_##name { \
struct trace_entry ent; \ struct trace_entry ent; \
tstruct \ tstruct \
}; \ }; \
static struct ftrace_event_call event_##name static struct ftrace_event_call event_##name
#undef TRACE_STRUCT
#define TRACE_STRUCT(args...) args
#define TRACE_FIELD(type, item, assign) \
type item;
#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
type_item;
#include <trace/trace_event_types.h> #include <trace/trace_event_types.h>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* field = (typeof(field))entry; * field = (typeof(field))entry;
* *
* ret = trace_seq_printf(s, <TPRAWFMT> "%s", <ARGS> "\n"); * ret = trace_seq_printf(s, <TP_RAW_FMT> "%s", <ARGS> "\n");
* if (!ret) * if (!ret)
* return TRACE_TYPE_PARTIAL_LINE; * return TRACE_TYPE_PARTIAL_LINE;
* *
...@@ -32,23 +32,14 @@ ...@@ -32,23 +32,14 @@
* in binary. * in binary.
*/ */
#undef TRACE_STRUCT #undef __entry
#define TRACE_STRUCT(args...) args #define __entry field
#undef TRACE_FIELD #undef TP_printk
#define TRACE_FIELD(type, item, assign) \ #define TP_printk(fmt, args...) fmt "\n", args
field->item,
#undef TRACE_FIELD_SPECIAL #undef TRACE_EVENT
#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \ #define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
field->item,
#undef TPRAWFMT
#define TPRAWFMT(args...) args
#undef TRACE_EVENT_FORMAT
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
enum print_line_t \ enum print_line_t \
ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
{ \ { \
...@@ -66,7 +57,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ ...@@ -66,7 +57,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
\ \
field = (typeof(field))entry; \ field = (typeof(field))entry; \
\ \
ret = trace_seq_printf(s, tpfmt "%s", tstruct "\n"); \ ret = trace_seq_printf(s, print); \
if (!ret) \ if (!ret) \
return TRACE_TYPE_PARTIAL_LINE; \ return TRACE_TYPE_PARTIAL_LINE; \
\ \
...@@ -75,5 +66,67 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ ...@@ -75,5 +66,67 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
#include <trace/trace_event_types.h> #include <trace/trace_event_types.h>
#include "trace_format.h" /*
* Setup the showing format of trace point.
*
* int
* ftrace_format_##call(struct trace_seq *s)
* {
* struct ftrace_raw_##call field;
* int ret;
*
* ret = trace_seq_printf(s, #type " " #item ";"
* " size:%d; offset:%d;\n",
* sizeof(field.type),
* offsetof(struct ftrace_raw_##call,
* item));
*
* }
*/
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args
#undef __field
#define __field(type, item) \
ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
"offset:%u;\tsize:%u;\n", \
(unsigned int)offsetof(typeof(field), item), \
(unsigned int)sizeof(field.item)); \
if (!ret) \
return 0;
#undef __array
#define __array(type, item, len) \
ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
"offset:%u;\tsize:%u;\n", \
(unsigned int)offsetof(typeof(field), item), \
(unsigned int)sizeof(field.item)); \
if (!ret) \
return 0;
#undef __entry
#define __entry "REC"
#undef TP_printk
#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
#undef TP_fast_assign
#define TP_fast_assign(args...) args
#undef TRACE_EVENT
#define TRACE_EVENT(call, proto, args, tstruct, print, func) \
static int \
ftrace_format_##call(struct trace_seq *s) \
{ \
struct ftrace_raw_##call field; \
int ret; \
\
tstruct; \
\
trace_seq_printf(s, "\nprint fmt: " print); \
\
return ret; \
}
#include <trace/trace_event_types.h> #include <trace/trace_event_types.h>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* } * }
* *
* *
* For those macros defined with TRACE_EVENT_FORMAT: * For those macros defined with TRACE_EVENT:
* *
* static struct ftrace_event_call event_<call>; * static struct ftrace_event_call event_<call>;
* *
...@@ -106,8 +106,8 @@ ...@@ -106,8 +106,8 @@
* *
*/ */
#undef TPFMT #undef TP_FMT
#define TPFMT(fmt, args...) fmt "\n", ##args #define TP_FMT(fmt, args...) fmt "\n", ##args
#define _TRACE_FORMAT(call, proto, args, fmt) \ #define _TRACE_FORMAT(call, proto, args, fmt) \
static void ftrace_event_##call(proto) \ static void ftrace_event_##call(proto) \
...@@ -139,32 +139,16 @@ static struct ftrace_event_call __used \ ...@@ -139,32 +139,16 @@ 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 = STR(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, \
} }
#undef TRACE_FIELD #undef __entry
#define TRACE_FIELD(type, item, assign)\ #define __entry entry
entry->item = assign;
#undef TRACE_FIELD #undef TRACE_EVENT
#define TRACE_FIELD(type, item, assign)\ #define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
entry->item = assign;
#undef TPCMD
#define TPCMD(cmd...) cmd
#undef TRACE_ENTRY
#define TRACE_ENTRY entry
#undef TRACE_FIELD_SPECIAL
#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
cmd;
#undef TRACE_EVENT_FORMAT
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
_TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) \
\ \
static struct ftrace_event_call event_##call; \ static struct ftrace_event_call event_##call; \
\ \
...@@ -185,7 +169,7 @@ static void ftrace_raw_event_##call(proto) \ ...@@ -185,7 +169,7 @@ static void ftrace_raw_event_##call(proto) \
return; \ return; \
entry = ring_buffer_event_data(event); \ entry = ring_buffer_event_data(event); \
\ \
tstruct; \ assign; \
\ \
trace_current_buffer_unlock_commit(event, irq_flags, pc); \ trace_current_buffer_unlock_commit(event, irq_flags, pc); \
} \ } \
...@@ -225,11 +209,9 @@ static struct ftrace_event_call __used \ ...@@ -225,11 +209,9 @@ 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 = STR(TRACE_SYSTEM), \ .system = __stringify(TRACE_SYSTEM), \
.regfunc = ftrace_reg_event_##call, \
.unregfunc = ftrace_unreg_event_##call, \
.raw_init = ftrace_raw_init_event_##call, \ .raw_init = ftrace_raw_init_event_##call, \
.raw_reg = ftrace_raw_reg_event_##call, \ .regfunc = ftrace_raw_reg_event_##call, \
.raw_unreg = ftrace_raw_unreg_event_##call, \ .unregfunc = ftrace_raw_unreg_event_##call, \
.show_format = ftrace_format_##call, \ .show_format = ftrace_format_##call, \
} }
...@@ -15,19 +15,40 @@ ...@@ -15,19 +15,40 @@
#include "trace_output.h" #include "trace_output.h"
#include "trace_format.h"
#undef TRACE_STRUCT
#define TRACE_STRUCT(args...) args
#undef TRACE_FIELD
#define TRACE_FIELD(type, item, assign) \
ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
"offset:%u;\tsize:%u;\n", \
(unsigned int)offsetof(typeof(field), item), \
(unsigned int)sizeof(field.item)); \
if (!ret) \
return 0;
#undef TRACE_FIELD_SPECIAL
#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \
"offset:%u;\tsize:%u;\n", \
(unsigned int)offsetof(typeof(field), item), \
(unsigned int)sizeof(field.item)); \
if (!ret) \
return 0;
#undef TRACE_FIELD_ZERO_CHAR #undef TRACE_FIELD_ZERO_CHAR
#define TRACE_FIELD_ZERO_CHAR(item) \ #define TRACE_FIELD_ZERO_CHAR(item) \
ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \ ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \
"offset:%lu;\tsize:0;\n", \ "offset:%u;\tsize:0;\n", \
offsetof(typeof(field), item)); \ (unsigned int)offsetof(typeof(field), item)); \
if (!ret) \ if (!ret) \
return 0; return 0;
#undef TPRAWFMT #undef TP_RAW_FMT
#define TPRAWFMT(args...) args #define TP_RAW_FMT(args...) args
#undef TRACE_EVENT_FORMAT #undef TRACE_EVENT_FORMAT
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
...@@ -57,8 +78,8 @@ ftrace_format_##call(struct trace_seq *s) \ ...@@ -57,8 +78,8 @@ ftrace_format_##call(struct trace_seq *s) \
#define TRACE_FIELD(type, item, assign)\ #define TRACE_FIELD(type, item, assign)\
entry->item = assign; entry->item = assign;
#undef TPCMD #undef TP_CMD
#define TPCMD(cmd...) cmd #define TP_CMD(cmd...) cmd
#undef TRACE_ENTRY #undef TRACE_ENTRY
#define TRACE_ENTRY entry #define TRACE_ENTRY entry
......
/*
* Setup the showing format of trace point.
*
* int
* ftrace_format_##call(struct trace_seq *s)
* {
* struct ftrace_raw_##call field;
* int ret;
*
* ret = trace_seq_printf(s, #type " " #item ";"
* " size:%d; offset:%d;\n",
* sizeof(field.type),
* offsetof(struct ftrace_raw_##call,
* item));
*
* }
*/
#undef TRACE_STRUCT
#define TRACE_STRUCT(args...) args
#undef TRACE_FIELD
#define TRACE_FIELD(type, item, assign) \
ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
"offset:%lu;\tsize:%lu;\n", \
offsetof(typeof(field), item), \
sizeof(field.item)); \
if (!ret) \
return 0;
#undef TRACE_FIELD_SPECIAL
#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \
"offset:%lu;\tsize:%lu;\n", \
offsetof(typeof(field), item), \
sizeof(field.item)); \
if (!ret) \
return 0;
#undef TRACE_EVENT_FORMAT
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
static int \
ftrace_format_##call(struct trace_seq *s) \
{ \
struct ftrace_raw_##call field; \
int ret; \
\
tstruct; \
\
trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \
\
return ret; \
}
/* Include in trace.c */ /* Include in trace.c */
#include <linux/stringify.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -100,9 +101,6 @@ static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret) ...@@ -100,9 +101,6 @@ static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret)
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
#define __STR(x) #x
#define STR(x) __STR(x)
/* Test dynamic code modification and ftrace filters */ /* Test dynamic code modification and ftrace filters */
int trace_selftest_startup_dynamic_tracing(struct tracer *trace, int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
struct trace_array *tr, struct trace_array *tr,
...@@ -130,7 +128,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace, ...@@ -130,7 +128,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
* start of the function names. We simply put a '*' to * start of the function names. We simply put a '*' to
* accommodate them. * accommodate them.
*/ */
func_name = "*" STR(DYN_FTRACE_TEST_NAME); func_name = "*" __stringify(DYN_FTRACE_TEST_NAME);
/* filter only on our function */ /* filter only on our function */
ftrace_set_filter(func_name, strlen(func_name), 1); ftrace_set_filter(func_name, strlen(func_name), 1);
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
DECLARE_TRACE(subsys_event, DECLARE_TRACE(subsys_event,
TPPROTO(struct inode *inode, struct file *file), TP_PROTO(struct inode *inode, struct file *file),
TPARGS(inode, file)); TP_ARGS(inode, file));
DECLARE_TRACE(subsys_eventb, DECLARE_TRACE(subsys_eventb,
TPPROTO(void), TP_PROTO(void),
TPARGS()); TP_ARGS());
#endif #endif
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