mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-21 00:42:16 +00:00
Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
This commit is contained in:
commit
9a1043d19c
@ -45,8 +45,8 @@ In include/trace/subsys.h :
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_TRACE(subsys_eventname,
|
||||
TPPROTO(int firstarg, struct task_struct *p),
|
||||
TPARGS(firstarg, p));
|
||||
TP_PROTO(int firstarg, struct task_struct *p),
|
||||
TP_ARGS(firstarg, p));
|
||||
|
||||
In subsys/file.c (where the tracing statement must be added) :
|
||||
|
||||
@ -66,10 +66,10 @@ Where :
|
||||
- subsys is the name of your subsystem.
|
||||
- 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.
|
||||
|
||||
- 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.
|
||||
|
||||
Connecting a function (probe) to a tracepoint is done by providing a
|
||||
|
@ -31,8 +31,8 @@ struct tracepoint {
|
||||
* Keep in sync with vmlinux.lds.h.
|
||||
*/
|
||||
|
||||
#define TPPROTO(args...) args
|
||||
#define TPARGS(args...) args
|
||||
#define TP_PROTO(args...) args
|
||||
#define TP_ARGS(args...) args
|
||||
|
||||
#ifdef CONFIG_TRACEPOINTS
|
||||
|
||||
@ -65,7 +65,7 @@ struct tracepoint {
|
||||
{ \
|
||||
if (unlikely(__tracepoint_##name.state)) \
|
||||
__DO_TRACE(&__tracepoint_##name, \
|
||||
TPPROTO(proto), TPARGS(args)); \
|
||||
TP_PROTO(proto), TP_ARGS(args)); \
|
||||
} \
|
||||
static inline int register_trace_##name(void (*probe)(proto)) \
|
||||
{ \
|
||||
@ -157,7 +157,7 @@ static inline void tracepoint_synchronize_unregister(void)
|
||||
#define TRACE_FORMAT(name, proto, args, fmt) \
|
||||
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
|
||||
|
||||
#define TRACE_EVENT_FORMAT(name, proto, args, fmt, struct, tpfmt) \
|
||||
TRACE_FORMAT(name, PARAMS(proto), PARAMS(args), PARAMS(fmt))
|
||||
#define TRACE_EVENT(name, proto, args, struct, print, assign) \
|
||||
DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
|
||||
|
||||
#endif
|
||||
|
@ -5,72 +5,72 @@
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_TRACE(block_rq_abort,
|
||||
TPPROTO(struct request_queue *q, struct request *rq),
|
||||
TPARGS(q, rq));
|
||||
TP_PROTO(struct request_queue *q, struct request *rq),
|
||||
TP_ARGS(q, rq));
|
||||
|
||||
DECLARE_TRACE(block_rq_insert,
|
||||
TPPROTO(struct request_queue *q, struct request *rq),
|
||||
TPARGS(q, rq));
|
||||
TP_PROTO(struct request_queue *q, struct request *rq),
|
||||
TP_ARGS(q, rq));
|
||||
|
||||
DECLARE_TRACE(block_rq_issue,
|
||||
TPPROTO(struct request_queue *q, struct request *rq),
|
||||
TPARGS(q, rq));
|
||||
TP_PROTO(struct request_queue *q, struct request *rq),
|
||||
TP_ARGS(q, rq));
|
||||
|
||||
DECLARE_TRACE(block_rq_requeue,
|
||||
TPPROTO(struct request_queue *q, struct request *rq),
|
||||
TPARGS(q, rq));
|
||||
TP_PROTO(struct request_queue *q, struct request *rq),
|
||||
TP_ARGS(q, rq));
|
||||
|
||||
DECLARE_TRACE(block_rq_complete,
|
||||
TPPROTO(struct request_queue *q, struct request *rq),
|
||||
TPARGS(q, rq));
|
||||
TP_PROTO(struct request_queue *q, struct request *rq),
|
||||
TP_ARGS(q, rq));
|
||||
|
||||
DECLARE_TRACE(block_bio_bounce,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio),
|
||||
TPARGS(q, bio));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio),
|
||||
TP_ARGS(q, bio));
|
||||
|
||||
DECLARE_TRACE(block_bio_complete,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio),
|
||||
TPARGS(q, bio));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio),
|
||||
TP_ARGS(q, bio));
|
||||
|
||||
DECLARE_TRACE(block_bio_backmerge,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio),
|
||||
TPARGS(q, bio));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio),
|
||||
TP_ARGS(q, bio));
|
||||
|
||||
DECLARE_TRACE(block_bio_frontmerge,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio),
|
||||
TPARGS(q, bio));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio),
|
||||
TP_ARGS(q, bio));
|
||||
|
||||
DECLARE_TRACE(block_bio_queue,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio),
|
||||
TPARGS(q, bio));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio),
|
||||
TP_ARGS(q, bio));
|
||||
|
||||
DECLARE_TRACE(block_getrq,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio, int rw),
|
||||
TPARGS(q, bio, rw));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
|
||||
TP_ARGS(q, bio, rw));
|
||||
|
||||
DECLARE_TRACE(block_sleeprq,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio, int rw),
|
||||
TPARGS(q, bio, rw));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
|
||||
TP_ARGS(q, bio, rw));
|
||||
|
||||
DECLARE_TRACE(block_plug,
|
||||
TPPROTO(struct request_queue *q),
|
||||
TPARGS(q));
|
||||
TP_PROTO(struct request_queue *q),
|
||||
TP_ARGS(q));
|
||||
|
||||
DECLARE_TRACE(block_unplug_timer,
|
||||
TPPROTO(struct request_queue *q),
|
||||
TPARGS(q));
|
||||
TP_PROTO(struct request_queue *q),
|
||||
TP_ARGS(q));
|
||||
|
||||
DECLARE_TRACE(block_unplug_io,
|
||||
TPPROTO(struct request_queue *q),
|
||||
TPARGS(q));
|
||||
TP_PROTO(struct request_queue *q),
|
||||
TP_ARGS(q));
|
||||
|
||||
DECLARE_TRACE(block_split,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu),
|
||||
TPARGS(q, bio, pdu));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio, unsigned int pdu),
|
||||
TP_ARGS(q, bio, pdu));
|
||||
|
||||
DECLARE_TRACE(block_remap,
|
||||
TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev,
|
||||
sector_t from, sector_t to),
|
||||
TPARGS(q, bio, dev, from, to));
|
||||
TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
|
||||
sector_t from, sector_t to),
|
||||
TP_ARGS(q, bio, dev, from, to));
|
||||
|
||||
#endif
|
||||
|
@ -8,26 +8,36 @@
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM irq
|
||||
|
||||
TRACE_EVENT_FORMAT(irq_handler_entry,
|
||||
TPPROTO(int irq, struct irqaction *action),
|
||||
TPARGS(irq, action),
|
||||
TPFMT("irq=%d handler=%s", irq, action->name),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(int, irq, irq)
|
||||
),
|
||||
TPRAWFMT("irq %d")
|
||||
/*
|
||||
* Tracepoint for entry of interrupt handler:
|
||||
*/
|
||||
TRACE_FORMAT(irq_handler_entry,
|
||||
TP_PROTO(int irq, struct irqaction *action),
|
||||
TP_ARGS(irq, action),
|
||||
TP_FMT("irq=%d handler=%s", irq, action->name)
|
||||
);
|
||||
|
||||
TRACE_EVENT_FORMAT(irq_handler_exit,
|
||||
TPPROTO(int irq, struct irqaction *action, int ret),
|
||||
TPARGS(irq, action, ret),
|
||||
TPFMT("irq=%d handler=%s return=%s",
|
||||
irq, action->name, ret ? "handled" : "unhandled"),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(int, irq, irq)
|
||||
TRACE_FIELD(int, ret, ret)
|
||||
/*
|
||||
* Tracepoint for return of an interrupt handler:
|
||||
*/
|
||||
TRACE_EVENT(irq_handler_exit,
|
||||
|
||||
TP_PROTO(int irq, struct irqaction *action, int 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#ifndef TRACE_EVENT_FORMAT
|
||||
#ifndef TRACE_FORMAT
|
||||
# error Do not include this file directly.
|
||||
# error Unless you know what you are doing.
|
||||
#endif
|
||||
@ -10,32 +10,32 @@
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
|
||||
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,
|
||||
struct lockdep_map *next_lock, unsigned long ip),
|
||||
TPARGS(lock, subclass, trylock, read, check, next_lock, ip),
|
||||
TPFMT("%s%s%s", trylock ? "try " : "",
|
||||
TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
|
||||
TP_FMT("%s%s%s", trylock ? "try " : "",
|
||||
read ? "read " : "", lock->name)
|
||||
);
|
||||
|
||||
TRACE_FORMAT(lock_release,
|
||||
TPPROTO(struct lockdep_map *lock, int nested, unsigned long ip),
|
||||
TPARGS(lock, nested, ip),
|
||||
TPFMT("%s", lock->name)
|
||||
TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
|
||||
TP_ARGS(lock, nested, ip),
|
||||
TP_FMT("%s", lock->name)
|
||||
);
|
||||
|
||||
#ifdef CONFIG_LOCK_STAT
|
||||
|
||||
TRACE_FORMAT(lock_contended,
|
||||
TPPROTO(struct lockdep_map *lock, unsigned long ip),
|
||||
TPARGS(lock, ip),
|
||||
TPFMT("%s", lock->name)
|
||||
TP_PROTO(struct lockdep_map *lock, unsigned long ip),
|
||||
TP_ARGS(lock, ip),
|
||||
TP_FMT("%s", lock->name)
|
||||
);
|
||||
|
||||
TRACE_FORMAT(lock_acquired,
|
||||
TPPROTO(struct lockdep_map *lock, unsigned long ip),
|
||||
TPARGS(lock, ip),
|
||||
TPFMT("%s", lock->name)
|
||||
TP_PROTO(struct lockdep_map *lock, unsigned long ip),
|
||||
TP_ARGS(lock, ip),
|
||||
TP_FMT("%s", lock->name)
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -18,15 +18,15 @@ struct power_trace {
|
||||
};
|
||||
|
||||
DECLARE_TRACE(power_start,
|
||||
TPPROTO(struct power_trace *it, unsigned int type, unsigned int state),
|
||||
TPARGS(it, type, state));
|
||||
TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
|
||||
TP_ARGS(it, type, state));
|
||||
|
||||
DECLARE_TRACE(power_mark,
|
||||
TPPROTO(struct power_trace *it, unsigned int type, unsigned int state),
|
||||
TPARGS(it, type, state));
|
||||
TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
|
||||
TP_ARGS(it, type, state));
|
||||
|
||||
DECLARE_TRACE(power_end,
|
||||
TPPROTO(struct power_trace *it),
|
||||
TPARGS(it));
|
||||
TP_PROTO(struct power_trace *it),
|
||||
TP_ARGS(it));
|
||||
|
||||
#endif /* _TRACE_POWER_H */
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/* use <trace/sched.h> instead */
|
||||
#ifndef TRACE_EVENT_FORMAT
|
||||
#ifndef TRACE_EVENT
|
||||
# error Do not include this file directly.
|
||||
# error Unless you know what you are doing.
|
||||
#endif
|
||||
@ -8,144 +8,330 @@
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM sched
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_kthread_stop,
|
||||
TPPROTO(struct task_struct *t),
|
||||
TPARGS(t),
|
||||
TPFMT("task %s:%d", t->comm, t->pid),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, t->pid)
|
||||
),
|
||||
TPRAWFMT("task %d")
|
||||
);
|
||||
/*
|
||||
* Tracepoint for calling kthread_stop, performed to end a kthread:
|
||||
*/
|
||||
TRACE_EVENT(sched_kthread_stop,
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_kthread_stop_ret,
|
||||
TPPROTO(int ret),
|
||||
TPARGS(ret),
|
||||
TPFMT("ret=%d", ret),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(int, ret, ret)
|
||||
),
|
||||
TPRAWFMT("ret=%d")
|
||||
);
|
||||
TP_PROTO(struct task_struct *t),
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_wait_task,
|
||||
TPPROTO(struct rq *rq, struct task_struct *p),
|
||||
TPARGS(rq, p),
|
||||
TPFMT("task %s:%d", p->comm, p->pid),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, p->pid)
|
||||
),
|
||||
TPRAWFMT("task %d")
|
||||
);
|
||||
TP_ARGS(t),
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_wakeup,
|
||||
TPPROTO(struct rq *rq, struct task_struct *p, int success),
|
||||
TPARGS(rq, p, success),
|
||||
TPFMT("task %s:%d %s",
|
||||
p->comm, p->pid, success ? "succeeded" : "failed"),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, p->pid)
|
||||
TRACE_FIELD(int, success, success)
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
),
|
||||
TPRAWFMT("task %d success=%d")
|
||||
);
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_wakeup_new,
|
||||
TPPROTO(struct rq *rq, struct task_struct *p, int success),
|
||||
TPARGS(rq, p, success),
|
||||
TPFMT("task %s:%d",
|
||||
p->comm, p->pid, success ? "succeeded" : "failed"),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, p->pid)
|
||||
TRACE_FIELD(int, success, success)
|
||||
),
|
||||
TPRAWFMT("task %d success=%d")
|
||||
);
|
||||
TP_printk("task %s:%d", __entry->comm, __entry->pid),
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_switch,
|
||||
TPPROTO(struct rq *rq, struct task_struct *prev,
|
||||
struct task_struct *next),
|
||||
TPARGS(rq, prev, next),
|
||||
TPFMT("task %s:%d ==> %s:%d",
|
||||
prev->comm, prev->pid, next->comm, next->pid),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, prev_pid, prev->pid)
|
||||
TRACE_FIELD(int, prev_prio, prev->prio)
|
||||
TRACE_FIELD_SPECIAL(char next_comm[TASK_COMM_LEN],
|
||||
next_comm,
|
||||
TPCMD(memcpy(TRACE_ENTRY->next_comm,
|
||||
next->comm,
|
||||
TASK_COMM_LEN)))
|
||||
TRACE_FIELD(pid_t, next_pid, next->pid)
|
||||
TRACE_FIELD(int, next_prio, next->prio)
|
||||
),
|
||||
TPRAWFMT("prev %d:%d ==> next %s:%d:%d")
|
||||
);
|
||||
TP_fast_assign(
|
||||
memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
|
||||
__entry->pid = t->pid;
|
||||
)
|
||||
);
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_migrate_task,
|
||||
TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
|
||||
TPARGS(p, orig_cpu, dest_cpu),
|
||||
TPFMT("task %s:%d from: %d to: %d",
|
||||
p->comm, p->pid, orig_cpu, dest_cpu),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, p->pid)
|
||||
TRACE_FIELD(int, orig_cpu, orig_cpu)
|
||||
TRACE_FIELD(int, dest_cpu, dest_cpu)
|
||||
),
|
||||
TPRAWFMT("task %d from: %d to: %d")
|
||||
);
|
||||
/*
|
||||
* Tracepoint for the return value of the kthread stopping:
|
||||
*/
|
||||
TRACE_EVENT(sched_kthread_stop_ret,
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_process_free,
|
||||
TPPROTO(struct task_struct *p),
|
||||
TPARGS(p),
|
||||
TPFMT("task %s:%d", p->comm, p->pid),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, p->pid)
|
||||
),
|
||||
TPRAWFMT("task %d")
|
||||
);
|
||||
TP_PROTO(int ret),
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_process_exit,
|
||||
TPPROTO(struct task_struct *p),
|
||||
TPARGS(p),
|
||||
TPFMT("task %s:%d", p->comm, p->pid),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, p->pid)
|
||||
),
|
||||
TPRAWFMT("task %d")
|
||||
);
|
||||
TP_ARGS(ret),
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_process_wait,
|
||||
TPPROTO(struct pid *pid),
|
||||
TPARGS(pid),
|
||||
TPFMT("pid %d", pid_nr(pid)),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, pid, pid_nr(pid))
|
||||
TP_STRUCT__entry(
|
||||
__field( int, ret )
|
||||
),
|
||||
TPRAWFMT("task %d")
|
||||
);
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_process_fork,
|
||||
TPPROTO(struct task_struct *parent, struct task_struct *child),
|
||||
TPARGS(parent, child),
|
||||
TPFMT("parent %s:%d child %s:%d",
|
||||
parent->comm, parent->pid, child->comm, child->pid),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(pid_t, parent, parent->pid)
|
||||
TRACE_FIELD(pid_t, child, child->pid)
|
||||
),
|
||||
TPRAWFMT("parent %d child %d")
|
||||
);
|
||||
TP_printk("ret %d", __entry->ret),
|
||||
|
||||
TRACE_EVENT_FORMAT(sched_signal_send,
|
||||
TPPROTO(int sig, struct task_struct *p),
|
||||
TPARGS(sig, p),
|
||||
TPFMT("sig: %d task %s:%d", sig, p->comm, p->pid),
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(int, sig, sig)
|
||||
TRACE_FIELD(pid_t, pid, p->pid)
|
||||
TP_fast_assign(
|
||||
__entry->ret = ret;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for waiting on task to unschedule:
|
||||
*
|
||||
* (NOTE: the 'rq' argument is not used by generic trace events,
|
||||
* but used by the latency tracer plugin. )
|
||||
*/
|
||||
TRACE_EVENT(sched_wait_task,
|
||||
|
||||
TP_PROTO(struct rq *rq, struct task_struct *p),
|
||||
|
||||
TP_ARGS(rq, p),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
__field( int, prio )
|
||||
),
|
||||
TPRAWFMT("sig: %d task %d")
|
||||
);
|
||||
|
||||
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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for waking up a task:
|
||||
*
|
||||
* (NOTE: the 'rq' argument is not used by generic trace events,
|
||||
* but used by the latency tracer plugin. )
|
||||
*/
|
||||
TRACE_EVENT(sched_wakeup,
|
||||
|
||||
TP_PROTO(struct rq *rq, struct task_struct *p, int success),
|
||||
|
||||
TP_ARGS(rq, p, success),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
__field( int, prio )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for waking up a new task:
|
||||
*
|
||||
* (NOTE: the 'rq' argument is not used by generic trace events,
|
||||
* but used by the latency tracer plugin. )
|
||||
*/
|
||||
TRACE_EVENT(sched_wakeup_new,
|
||||
|
||||
TP_PROTO(struct rq *rq, struct task_struct *p, int success),
|
||||
|
||||
TP_ARGS(rq, p, success),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
__field( int, prio )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for task switches, performed by the scheduler:
|
||||
*
|
||||
* (NOTE: the 'rq' argument is not used by generic trace events,
|
||||
* but used by the latency tracer plugin. )
|
||||
*/
|
||||
TRACE_EVENT(sched_switch,
|
||||
|
||||
TP_PROTO(struct rq *rq, struct task_struct *prev,
|
||||
struct task_struct *next),
|
||||
|
||||
TP_ARGS(rq, prev, next),
|
||||
|
||||
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 )
|
||||
),
|
||||
|
||||
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;
|
||||
__entry->prev_prio = prev->prio;
|
||||
memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
|
||||
__entry->next_pid = next->pid;
|
||||
__entry->next_prio = next->prio;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for a task being migrated:
|
||||
*/
|
||||
TRACE_EVENT(sched_migrate_task,
|
||||
|
||||
TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
|
||||
|
||||
TP_ARGS(p, orig_cpu, dest_cpu),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
__field( int, prio )
|
||||
__field( int, orig_cpu )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for freeing a task:
|
||||
*/
|
||||
TRACE_EVENT(sched_process_free,
|
||||
|
||||
TP_PROTO(struct task_struct *p),
|
||||
|
||||
TP_ARGS(p),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for a task exiting:
|
||||
*/
|
||||
TRACE_EVENT(sched_process_exit,
|
||||
|
||||
TP_PROTO(struct task_struct *p),
|
||||
|
||||
TP_ARGS(p),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for a waiting task:
|
||||
*/
|
||||
TRACE_EVENT(sched_process_wait,
|
||||
|
||||
TP_PROTO(struct pid *pid),
|
||||
|
||||
TP_ARGS(pid),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__field( pid_t, pid )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for do_fork:
|
||||
*/
|
||||
TRACE_EVENT(sched_process_fork,
|
||||
|
||||
TP_PROTO(struct task_struct *parent, struct task_struct *child),
|
||||
|
||||
TP_ARGS(parent, child),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, parent_comm, TASK_COMM_LEN )
|
||||
__field( pid_t, parent_pid )
|
||||
__array( char, child_comm, TASK_COMM_LEN )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
* Tracepoint for sending a signal:
|
||||
*/
|
||||
TRACE_EVENT(sched_signal_send,
|
||||
|
||||
TP_PROTO(int sig, struct task_struct *p),
|
||||
|
||||
TP_ARGS(sig, p),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( int, sig )
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
__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;
|
||||
)
|
||||
);
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
|
@ -6,20 +6,20 @@
|
||||
#include <linux/sched.h>
|
||||
|
||||
DECLARE_TRACE(workqueue_insertion,
|
||||
TPPROTO(struct task_struct *wq_thread, struct work_struct *work),
|
||||
TPARGS(wq_thread, work));
|
||||
TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
|
||||
TP_ARGS(wq_thread, work));
|
||||
|
||||
DECLARE_TRACE(workqueue_execution,
|
||||
TPPROTO(struct task_struct *wq_thread, struct work_struct *work),
|
||||
TPARGS(wq_thread, work));
|
||||
TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
|
||||
TP_ARGS(wq_thread, work));
|
||||
|
||||
/* Trace the creation of one workqueue thread on a cpu */
|
||||
DECLARE_TRACE(workqueue_creation,
|
||||
TPPROTO(struct task_struct *wq_thread, int cpu),
|
||||
TPARGS(wq_thread, cpu));
|
||||
TP_PROTO(struct task_struct *wq_thread, int cpu),
|
||||
TP_ARGS(wq_thread, cpu));
|
||||
|
||||
DECLARE_TRACE(workqueue_destruction,
|
||||
TPPROTO(struct task_struct *wq_thread),
|
||||
TPARGS(wq_thread));
|
||||
TP_PROTO(struct task_struct *wq_thread),
|
||||
TP_ARGS(wq_thread));
|
||||
|
||||
#endif /* __TRACE_WORKQUEUE_H */
|
||||
|
@ -2,9 +2,7 @@
|
||||
* This is the place to register all trace points as events.
|
||||
*/
|
||||
|
||||
/* someday this needs to go in a generic header */
|
||||
#define __STR(x) #x
|
||||
#define STR(x) __STR(x)
|
||||
#include <linux/stringify.h>
|
||||
|
||||
#include <trace/trace_events.h>
|
||||
|
||||
|
@ -751,12 +751,7 @@ struct ftrace_event_call {
|
||||
int (*regfunc)(void);
|
||||
void (*unregfunc)(void);
|
||||
int id;
|
||||
struct dentry *raw_dir;
|
||||
int raw_enabled;
|
||||
int type;
|
||||
int (*raw_init)(void);
|
||||
int (*raw_reg)(void);
|
||||
void (*raw_unreg)(void);
|
||||
int (*show_format)(struct trace_seq *s);
|
||||
};
|
||||
|
||||
|
@ -10,7 +10,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
|
||||
TRACE_FIELD(unsigned long, ip, 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,
|
||||
@ -19,7 +19,7 @@ TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
|
||||
TRACE_FIELD(unsigned long, graph_ent.func, func)
|
||||
TRACE_FIELD(int, graph_ent.depth, depth)
|
||||
),
|
||||
TPRAWFMT("--> %lx (%d)")
|
||||
TP_RAW_FMT("--> %lx (%d)")
|
||||
);
|
||||
|
||||
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(int, ret.depth, depth)
|
||||
),
|
||||
TPRAWFMT("<-- %lx (%d)")
|
||||
TP_RAW_FMT("<-- %lx (%d)")
|
||||
);
|
||||
|
||||
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 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,
|
||||
@ -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 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,
|
||||
@ -63,7 +63,7 @@ TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore,
|
||||
TRACE_FIELD(unsigned long, arg2, arg2)
|
||||
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,
|
||||
TRACE_FIELD(unsigned long, caller[6], stack6)
|
||||
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")
|
||||
);
|
||||
|
||||
@ -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[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")
|
||||
);
|
||||
|
||||
@ -106,9 +106,10 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
|
||||
TRACE_STRUCT(
|
||||
TRACE_FIELD(unsigned long, ip, ip)
|
||||
TRACE_FIELD(unsigned int, depth, depth)
|
||||
TRACE_FIELD(char *, fmt, fmt)
|
||||
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,
|
||||
@ -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(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,
|
||||
@ -126,7 +127,7 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
|
||||
TRACE_FIELD(u64, from, from)
|
||||
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,
|
||||
@ -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.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,
|
||||
@ -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(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")
|
||||
);
|
||||
|
||||
@ -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(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
|
||||
|
@ -59,22 +59,12 @@ static void ftrace_event_enable_disable(struct ftrace_event_call *call,
|
||||
call->enabled = 0;
|
||||
call->unregfunc();
|
||||
}
|
||||
if (call->raw_enabled) {
|
||||
call->raw_enabled = 0;
|
||||
call->raw_unreg();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!call->enabled &&
|
||||
(call->type & TRACE_EVENT_TYPE_PRINTF)) {
|
||||
if (!call->enabled) {
|
||||
call->enabled = 1;
|
||||
call->regfunc();
|
||||
}
|
||||
if (!call->raw_enabled &&
|
||||
(call->type & TRACE_EVENT_TYPE_RAW)) {
|
||||
call->raw_enabled = 1;
|
||||
call->raw_reg();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -300,7 +290,7 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
|
||||
struct ftrace_event_call *call = filp->private_data;
|
||||
char *buf;
|
||||
|
||||
if (call->enabled || call->raw_enabled)
|
||||
if (call->enabled)
|
||||
buf = "1\n";
|
||||
else
|
||||
buf = "0\n";
|
||||
@ -346,110 +336,10 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t 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
|
||||
#define FIELD(type, name) \
|
||||
#type, #name, offsetof(typeof(field), name), sizeof(field.name)
|
||||
#define FIELD(type, name) \
|
||||
#type, #name, (unsigned int)offsetof(typeof(field), name), \
|
||||
(unsigned int)sizeof(field.name)
|
||||
|
||||
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 */
|
||||
return trace_seq_printf(s,
|
||||
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n"
|
||||
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n"
|
||||
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n"
|
||||
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n"
|
||||
"\tfield:%s %s;\toffset:%lu;\tsize:%lu;\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:%u;\tsize:%u;\n"
|
||||
"\n",
|
||||
FIELD(unsigned char, type),
|
||||
FIELD(unsigned char, flags),
|
||||
@ -469,6 +359,7 @@ static int trace_write_header(struct trace_seq *s)
|
||||
FIELD(int, pid),
|
||||
FIELD(int, tgid));
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
|
||||
loff_t *ppos)
|
||||
@ -526,13 +417,6 @@ 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,
|
||||
@ -547,17 +431,6 @@ static const struct file_operations ftrace_enable_fops = {
|
||||
.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 = {
|
||||
.open = tracing_open_generic,
|
||||
.read = event_format_read,
|
||||
@ -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);
|
||||
if (!call->dir) {
|
||||
pr_warning("Could not create debugfs "
|
||||
@ -664,21 +534,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
|
||||
"'%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 */
|
||||
if (!call->show_format)
|
||||
return 0;
|
||||
@ -703,13 +558,6 @@ 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);
|
||||
|
@ -17,20 +17,21 @@
|
||||
#undef TRACE_FORMAT
|
||||
#define TRACE_FORMAT(call, proto, args, fmt)
|
||||
|
||||
#undef TRACE_EVENT_FORMAT
|
||||
#define TRACE_EVENT_FORMAT(name, proto, args, fmt, tstruct, tpfmt) \
|
||||
struct ftrace_raw_##name { \
|
||||
struct trace_entry ent; \
|
||||
tstruct \
|
||||
}; \
|
||||
#undef __array
|
||||
#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 trace_entry ent; \
|
||||
tstruct \
|
||||
}; \
|
||||
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>
|
||||
|
@ -20,7 +20,7 @@
|
||||
*
|
||||
* 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)
|
||||
* return TRACE_TYPE_PARTIAL_LINE;
|
||||
*
|
||||
@ -32,23 +32,14 @@
|
||||
* in binary.
|
||||
*/
|
||||
|
||||
#undef TRACE_STRUCT
|
||||
#define TRACE_STRUCT(args...) args
|
||||
#undef __entry
|
||||
#define __entry field
|
||||
|
||||
#undef TRACE_FIELD
|
||||
#define TRACE_FIELD(type, item, assign) \
|
||||
field->item,
|
||||
#undef TP_printk
|
||||
#define TP_printk(fmt, args...) fmt "\n", args
|
||||
|
||||
#undef TRACE_FIELD_SPECIAL
|
||||
#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
|
||||
field->item,
|
||||
|
||||
|
||||
#undef TPRAWFMT
|
||||
#define TPRAWFMT(args...) args
|
||||
|
||||
#undef TRACE_EVENT_FORMAT
|
||||
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
|
||||
#undef TRACE_EVENT
|
||||
#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
|
||||
enum print_line_t \
|
||||
ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
|
||||
{ \
|
||||
@ -66,14 +57,76 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
|
||||
\
|
||||
field = (typeof(field))entry; \
|
||||
\
|
||||
ret = trace_seq_printf(s, tpfmt "%s", tstruct "\n"); \
|
||||
ret = trace_seq_printf(s, print); \
|
||||
if (!ret) \
|
||||
return TRACE_TYPE_PARTIAL_LINE; \
|
||||
\
|
||||
return TRACE_TYPE_HANDLED; \
|
||||
}
|
||||
|
||||
|
||||
#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>
|
||||
|
@ -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>;
|
||||
*
|
||||
@ -106,8 +106,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#undef TPFMT
|
||||
#define TPFMT(fmt, args...) fmt "\n", ##args
|
||||
#undef TP_FMT
|
||||
#define TP_FMT(fmt, args...) fmt "\n", ##args
|
||||
|
||||
#define _TRACE_FORMAT(call, proto, args, fmt) \
|
||||
static void ftrace_event_##call(proto) \
|
||||
@ -139,32 +139,16 @@ static struct ftrace_event_call __used \
|
||||
__attribute__((__aligned__(4))) \
|
||||
__attribute__((section("_ftrace_events"))) event_##call = { \
|
||||
.name = #call, \
|
||||
.system = STR(TRACE_SYSTEM), \
|
||||
.system = __stringify(TRACE_SYSTEM), \
|
||||
.regfunc = ftrace_reg_event_##call, \
|
||||
.unregfunc = ftrace_unreg_event_##call, \
|
||||
}
|
||||
|
||||
#undef TRACE_FIELD
|
||||
#define TRACE_FIELD(type, item, assign)\
|
||||
entry->item = assign;
|
||||
#undef __entry
|
||||
#define __entry entry
|
||||
|
||||
#undef TRACE_FIELD
|
||||
#define TRACE_FIELD(type, item, 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)) \
|
||||
#undef TRACE_EVENT
|
||||
#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
|
||||
\
|
||||
static struct ftrace_event_call event_##call; \
|
||||
\
|
||||
@ -185,7 +169,7 @@ static void ftrace_raw_event_##call(proto) \
|
||||
return; \
|
||||
entry = ring_buffer_event_data(event); \
|
||||
\
|
||||
tstruct; \
|
||||
assign; \
|
||||
\
|
||||
trace_current_buffer_unlock_commit(event, irq_flags, pc); \
|
||||
} \
|
||||
@ -225,11 +209,9 @@ static struct ftrace_event_call __used \
|
||||
__attribute__((__aligned__(4))) \
|
||||
__attribute__((section("_ftrace_events"))) event_##call = { \
|
||||
.name = #call, \
|
||||
.system = STR(TRACE_SYSTEM), \
|
||||
.regfunc = ftrace_reg_event_##call, \
|
||||
.unregfunc = ftrace_unreg_event_##call, \
|
||||
.system = __stringify(TRACE_SYSTEM), \
|
||||
.raw_init = ftrace_raw_init_event_##call, \
|
||||
.raw_reg = ftrace_raw_reg_event_##call, \
|
||||
.raw_unreg = ftrace_raw_unreg_event_##call, \
|
||||
.regfunc = ftrace_raw_reg_event_##call, \
|
||||
.unregfunc = ftrace_raw_unreg_event_##call, \
|
||||
.show_format = ftrace_format_##call, \
|
||||
}
|
||||
|
@ -15,19 +15,40 @@
|
||||
|
||||
#include "trace_output.h"
|
||||
|
||||
#include "trace_format.h"
|
||||
|
||||
#undef TRACE_FIELD_ZERO_CHAR
|
||||
#define TRACE_FIELD_ZERO_CHAR(item) \
|
||||
ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \
|
||||
"offset:%lu;\tsize:0;\n", \
|
||||
offsetof(typeof(field), item)); \
|
||||
if (!ret) \
|
||||
#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 TPRAWFMT
|
||||
#define TPRAWFMT(args...) args
|
||||
#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
|
||||
#define TRACE_FIELD_ZERO_CHAR(item) \
|
||||
ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \
|
||||
"offset:%u;\tsize:0;\n", \
|
||||
(unsigned int)offsetof(typeof(field), item)); \
|
||||
if (!ret) \
|
||||
return 0;
|
||||
|
||||
|
||||
#undef TP_RAW_FMT
|
||||
#define TP_RAW_FMT(args...) args
|
||||
|
||||
#undef TRACE_EVENT_FORMAT
|
||||
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
|
||||
@ -57,8 +78,8 @@ ftrace_format_##call(struct trace_seq *s) \
|
||||
#define TRACE_FIELD(type, item, assign)\
|
||||
entry->item = assign;
|
||||
|
||||
#undef TPCMD
|
||||
#define TPCMD(cmd...) cmd
|
||||
#undef TP_CMD
|
||||
#define TP_CMD(cmd...) cmd
|
||||
|
||||
#undef TRACE_ENTRY
|
||||
#define TRACE_ENTRY entry
|
||||
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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; \
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* Include in trace.c */
|
||||
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
@ -100,9 +101,6 @@ static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret)
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_FTRACE
|
||||
|
||||
#define __STR(x) #x
|
||||
#define STR(x) __STR(x)
|
||||
|
||||
/* Test dynamic code modification and ftrace filters */
|
||||
int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
|
||||
struct trace_array *tr,
|
||||
@ -130,7 +128,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
|
||||
* start of the function names. We simply put a '*' to
|
||||
* accommodate them.
|
||||
*/
|
||||
func_name = "*" STR(DYN_FTRACE_TEST_NAME);
|
||||
func_name = "*" __stringify(DYN_FTRACE_TEST_NAME);
|
||||
|
||||
/* filter only on our function */
|
||||
ftrace_set_filter(func_name, strlen(func_name), 1);
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_TRACE(subsys_event,
|
||||
TPPROTO(struct inode *inode, struct file *file),
|
||||
TPARGS(inode, file));
|
||||
TP_PROTO(struct inode *inode, struct file *file),
|
||||
TP_ARGS(inode, file));
|
||||
DECLARE_TRACE(subsys_eventb,
|
||||
TPPROTO(void),
|
||||
TPARGS());
|
||||
TP_PROTO(void),
|
||||
TP_ARGS());
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user