From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Theodore Tso <tytso@mit.edu>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Mathieu Desnoyers <compudj@krystal.dyndns.org>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
"Martin J. Bligh" <mbligh@mbligh.org>,
"Frank Ch. Eigler" <fche@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Larry Woodman <lwoodman@redhat.com>,
Jason Baron <jbaron@redhat.com>, Tom Zanussi <tzanussi@gmail.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
Jiaying Zhang <jiayingz@google.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 5/7] tracing: convert the sched trace points to the TRACE_EVENT macros
Date: Tue, 10 Mar 2009 00:57:15 -0400 [thread overview]
Message-ID: <20090310045811.520029745@goodmis.org> (raw)
In-Reply-To: 20090310045710.286915983@goodmis.org
[-- Attachment #1: 0005-tracing-convert-the-sched-trace-points-to-the-TRACE.patch --]
[-- Type: text/plain, Size: 9127 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Impact: enhancement
This patch converts the rest of the sched trace points to use the new
more powerful TRACE_EVENT macro.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
include/trace/sched_event_types.h | 322 ++++++++++++++++++++++++++++---------
1 files changed, 246 insertions(+), 76 deletions(-)
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h
index aa77fb7..0bbbf41 100644
--- a/include/trace/sched_event_types.h
+++ b/include/trace/sched_event_types.h
@@ -8,59 +8,137 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM sched
-TRACE_EVENT_FORMAT(sched_kthread_stop,
+/*
+ * Tracepoint for calling kthread_stop, performed to end a kthread:
+ */
+TRACE_EVENT(sched_kthread_stop,
+
TP_PROTO(struct task_struct *t),
+
TP_ARGS(t),
- TP_FMT("task %s:%d", t->comm, t->pid),
- TRACE_STRUCT(
- TRACE_FIELD(pid_t, pid, t->pid)
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
),
- TP_RAW_FMT("task %d")
- );
-TRACE_EVENT_FORMAT(sched_kthread_stop_ret,
+ TP_printk("task %s:%d", __entry->comm, __entry->pid),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
+ __entry->pid = t->pid;
+ )
+);
+
+/*
+ * Tracepoint for the return value of the kthread stopping:
+ */
+TRACE_EVENT(sched_kthread_stop_ret,
+
TP_PROTO(int ret),
+
TP_ARGS(ret),
- TP_FMT("ret=%d", ret),
- TRACE_STRUCT(
- TRACE_FIELD(int, ret, ret)
+
+ TP_STRUCT__entry(
+ __field( int, ret )
),
- TP_RAW_FMT("ret=%d")
- );
-TRACE_EVENT_FORMAT(sched_wait_task,
+ TP_printk("ret %d", __entry->ret),
+
+ 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_FMT("task %s:%d", p->comm, p->pid),
- TRACE_STRUCT(
- TRACE_FIELD(pid_t, pid, p->pid)
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
),
- TP_RAW_FMT("task %d")
- );
-TRACE_EVENT_FORMAT(sched_wakeup,
+ 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_FMT("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 )
+ __field( int, prio )
+ __field( int, success )
),
- TP_RAW_FMT("task %d success=%d")
- );
-TRACE_EVENT_FORMAT(sched_wakeup_new,
+ 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_FMT("task %s:%d",
- 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 )
+ __field( int, prio )
+ __field( int, success )
),
- TP_RAW_FMT("task %d success=%d")
- );
+
+ 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:
@@ -98,70 +176,162 @@ TRACE_EVENT(sched_switch,
)
);
-TRACE_EVENT_FORMAT(sched_migrate_task,
+/*
+ * 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_FMT("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)
+
+ 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_RAW_FMT("task %d from: %d to: %d")
- );
-TRACE_EVENT_FORMAT(sched_process_free,
+ 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_FMT("task %s:%d", p->comm, p->pid),
- TRACE_STRUCT(
- TRACE_FIELD(pid_t, pid, p->pid)
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
),
- TP_RAW_FMT("task %d")
- );
-TRACE_EVENT_FORMAT(sched_process_exit,
+ 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_FMT("task %s:%d", p->comm, p->pid),
- TRACE_STRUCT(
- TRACE_FIELD(pid_t, pid, p->pid)
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
),
- TP_RAW_FMT("task %d")
- );
-TRACE_EVENT_FORMAT(sched_process_wait,
+ 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_FMT("pid %d", pid_nr(pid)),
- TRACE_STRUCT(
- TRACE_FIELD(pid_t, pid, pid_nr(pid))
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
),
- TP_RAW_FMT("task %d")
- );
-TRACE_EVENT_FORMAT(sched_process_fork,
+ 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_FMT("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)
+
+ 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_RAW_FMT("parent %d child %d")
- );
-TRACE_EVENT_FORMAT(sched_signal_send,
+ 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_FMT("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_STRUCT__entry(
+ __field( int, sig )
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
),
- TP_RAW_FMT("sig: %d task %d")
- );
+
+ 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
--
1.6.1.3
--
next prev parent reply other threads:[~2009-03-10 4:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 4:57 [PATCH 0/7] [GIT PULL] enhancements for tracing in tip Steven Rostedt
2009-03-10 4:57 ` [PATCH 1/7] tracing: typecast sizeof and offsetof to unsigned int Steven Rostedt
2009-03-10 5:20 ` Andrew Morton
2009-03-10 13:39 ` Steven Rostedt
2009-03-10 4:57 ` [PATCH 2/7] tracing: replace TP<var> with TP_<var> Steven Rostedt
2009-03-17 7:58 ` Christoph Hellwig
2009-03-17 15:30 ` Steven Rostedt
2009-03-10 4:57 ` [PATCH 3/7] tracing: use generic __stringify Steven Rostedt
2009-03-10 10:56 ` Frederic Weisbecker
2009-03-10 11:18 ` KOSAKI Motohiro
2009-03-10 11:21 ` Peter Zijlstra
2009-03-10 15:48 ` Frédéric Weisbecker
2009-03-10 4:57 ` [PATCH 4/7] tracing: new format for specialized trace points Steven Rostedt
2009-03-10 5:50 ` KOSAKI Motohiro
2009-03-10 8:54 ` Ingo Molnar
2009-03-10 13:45 ` Steven Rostedt
2009-03-10 9:54 ` KOSAKI Motohiro
2009-03-10 13:55 ` Steven Rostedt
2009-03-17 8:08 ` Christoph Hellwig
2009-03-17 15:41 ` Steven Rostedt
2009-03-10 4:57 ` Steven Rostedt [this message]
2009-03-10 4:57 ` [PATCH 6/7] tracing: convert irq trace points to new macros Steven Rostedt
2009-03-10 4:57 ` [PATCH 7/7] tracing: remove obsolete TRACE_EVENT_FORMAT macro Steven Rostedt
2009-03-17 8:08 ` Christoph Hellwig
2009-03-10 8:59 ` [PATCH 0/7] [GIT PULL] enhancements for tracing in tip Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090310045811.520029745@goodmis.org \
--to=rostedt@goodmis.org \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=compudj@krystal.dyndns.org \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hch@infradead.org \
--cc=hpa@zytor.com \
--cc=jbaron@redhat.com \
--cc=jiayingz@google.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lwoodman@redhat.com \
--cc=mbligh@mbligh.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
--cc=tytso@mit.edu \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox