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>,
Linus Torvalds <torvalds@linux-foundation.org>,
Theodore Tso <tytso@mit.edu>,
Arjan van de Ven <arjan@infradead.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [RFC][PATCH 4/5] [PATCH 4/5] tracing/events: Add stable event sched_switch
Date: Tue, 16 Nov 2010 19:54:01 -0500 [thread overview]
Message-ID: <20101117005940.416708704@goodmis.org> (raw)
In-Reply-To: 20101117005357.024472450@goodmis.org
[-- Attachment #1: 0004-tracing-events-Add-stable-event-sched_switch.patch --]
[-- Type: text/plain, Size: 2628 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Add the stable event for sched_switch.
[root@bxf ~]# cat /sys/kernel/event/sched_switch/format
array:prev_comm type:char size:8 count:16 align:1 signed:1;
field:prev_pid type:pid_t size:32 align:4 signed:1;
field:prev_state type:char size:8 align:1 signed:1;
array:next_comm type:char size:8 count:16 align:1 signed:1;
field:next_pid type:pid_t size:32 align:4 signed:1;
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/trace/stable/sched.h | 20 ++++++++++++++++++++
include/trace/stable_list.h | 1 +
kernel/events/events.c | 22 ++++++++++++++++++++++
3 files changed, 43 insertions(+), 0 deletions(-)
create mode 100644 include/trace/stable/sched.h
diff --git a/include/trace/stable/sched.h b/include/trace/stable/sched.h
new file mode 100644
index 0000000..b5f4fd7
--- /dev/null
+++ b/include/trace/stable/sched.h
@@ -0,0 +1,20 @@
+#if !defined(_STABLE_SCHED_H) || defined(STABLE_HEADER_MULTI_READ)
+#define _STABLE_SCHED_H
+
+#include <linux/sched.h>
+
+/*
+ * Tracepoint for task switches, performed by the scheduler:
+ */
+STABLE_EVENT(sched_switch,
+
+ EVENT_STRUCT(
+ __array( char, prev_comm, TASK_COMM_LEN )__SEP__
+ __field( pid_t, prev_pid )__SEP__
+ __field( char, prev_state )__SEP__
+ __array( char, next_comm, TASK_COMM_LEN )__SEP__
+ __field( pid_t, next_pid )
+ )
+);
+
+#endif /* _STABLE_SCHED_H */
diff --git a/include/trace/stable_list.h b/include/trace/stable_list.h
index 996932a..9cbc006 100644
--- a/include/trace/stable_list.h
+++ b/include/trace/stable_list.h
@@ -1,2 +1,3 @@
/* New stable defines must be added here */
+#include <trace/stable/sched.h>
diff --git a/kernel/events/events.c b/kernel/events/events.c
index 6868bf1..f69e720 100644
--- a/kernel/events/events.c
+++ b/kernel/events/events.c
@@ -13,4 +13,26 @@
static struct mutex stable_event_mutex;
+#include <trace/events/sched.h>
+
+DECLARE_TRACE(stable_sched_switch,
+ TP_PROTO(char *prev_comm, pid_t prev_pid, char prev_state,
+ char *next_comm, pid_t next_pid),
+ TP_ARGS(prev_comm, prev_pid, prev_state, next_comm, next_pid));
+DEFINE_TRACE(stable_sched_switch);
+
+static const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
+static void hook_sched_switch(void *ignore,
+ struct task_struct *prev,
+ struct task_struct *next)
+{
+ unsigned state;
+
+ state = prev->state ? __ffs(prev->state) + 1 : 0;
+ state = state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?';
+
+ trace_stable_sched_switch(prev->comm, prev->pid, state,
+ next->comm, next->pid);
+}
+
#include "event_reg.h"
--
1.7.1
next prev parent reply other threads:[~2010-11-17 1:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-17 0:53 [RFC][PATCH 0/5] tracing/events: stable tracepoints Steven Rostedt
2010-11-17 0:53 ` [RFC][PATCH 1/5] [PATCH 1/5] events: Add EVENT_FS the event filesystem Steven Rostedt
2010-11-17 3:32 ` Greg KH
2010-11-17 10:39 ` Ingo Molnar
2010-11-17 12:25 ` Steven Rostedt
2010-11-17 15:03 ` Ingo Molnar
2010-11-17 15:16 ` Peter Zijlstra
2010-11-17 15:16 ` Steven Rostedt
2010-11-17 15:35 ` Peter Zijlstra
2010-11-17 18:42 ` Ted Ts'o
2010-11-17 15:16 ` Peter Zijlstra
2010-11-23 21:29 ` Steven Rostedt
2010-11-17 17:46 ` Mathieu Desnoyers
2010-11-17 17:52 ` Steven Rostedt
2010-11-17 18:12 ` Mathieu Desnoyers
2010-11-18 9:42 ` Avi Kivity
2010-11-17 23:48 ` Ted Ts'o
2010-11-18 13:05 ` Mathieu Desnoyers
2010-11-17 12:16 ` Steven Rostedt
2010-11-17 0:53 ` [RFC][PATCH 2/5] [PATCH 2/5] tracing/events: Add code to (un)register stable events Steven Rostedt
2010-11-17 0:54 ` [RFC][PATCH 3/5] [PATCH 3/5] tracing/events: Add infrastructure to show stable event formats Steven Rostedt
2010-11-17 0:54 ` Steven Rostedt [this message]
2010-11-17 0:54 ` [RFC][PATCH 5/5] [PATCH 5/5] tracing/events: Add sched_migrate_task stable event Steven Rostedt
2010-11-17 20:14 ` [RFC][PATCH 0/5] tracing/events: stable tracepoints Mathieu Desnoyers
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=20101117005940.416708704@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).