diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2009-05-15 10:51:13 -0400 |
|---|---|---|
| committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-05-26 14:29:19 -0400 |
| commit | 937cdb9db7f59278d0cb1582e6e64e3dfd73b4fc (patch) | |
| tree | 11ade43ae91890ad025fa97a9fd651b9149518dc | |
| parent | be74b73a57645cc253d881ab0c1014eb64b9cf22 (diff) | |
tracing: add previous task state info to sched switch event
It is useful to see the state of a task that is being switched out.
This patch adds the output of the state of the previous task in
the context switch event.
[ Impact: see state of switched out task in context switch ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
| -rw-r--r-- | include/trace/events/sched.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index dd4033cf5b09..24ab5bcff7b2 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -156,6 +156,7 @@ TRACE_EVENT(sched_switch, | |||
| 156 | __array( char, prev_comm, TASK_COMM_LEN ) | 156 | __array( char, prev_comm, TASK_COMM_LEN ) |
| 157 | __field( pid_t, prev_pid ) | 157 | __field( pid_t, prev_pid ) |
| 158 | __field( int, prev_prio ) | 158 | __field( int, prev_prio ) |
| 159 | __field( long, prev_state ) | ||
| 159 | __array( char, next_comm, TASK_COMM_LEN ) | 160 | __array( char, next_comm, TASK_COMM_LEN ) |
| 160 | __field( pid_t, next_pid ) | 161 | __field( pid_t, next_pid ) |
| 161 | __field( int, next_prio ) | 162 | __field( int, next_prio ) |
| @@ -165,13 +166,19 @@ TRACE_EVENT(sched_switch, | |||
| 165 | memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); | 166 | memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); |
| 166 | __entry->prev_pid = prev->pid; | 167 | __entry->prev_pid = prev->pid; |
| 167 | __entry->prev_prio = prev->prio; | 168 | __entry->prev_prio = prev->prio; |
| 169 | __entry->prev_state = prev->state; | ||
| 168 | memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); | 170 | memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); |
| 169 | __entry->next_pid = next->pid; | 171 | __entry->next_pid = next->pid; |
| 170 | __entry->next_prio = next->prio; | 172 | __entry->next_prio = next->prio; |
| 171 | ), | 173 | ), |
| 172 | 174 | ||
| 173 | TP_printk("task %s:%d [%d] ==> %s:%d [%d]", | 175 | TP_printk("task %s:%d [%d] (%s) ==> %s:%d [%d]", |
| 174 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, | 176 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, |
| 177 | __entry->prev_state ? | ||
| 178 | __print_flags(__entry->prev_state, "|", | ||
| 179 | { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, | ||
| 180 | { 16, "Z" }, { 32, "X" }, { 64, "x" }, | ||
| 181 | { 128, "W" }) : "R", | ||
| 175 | __entry->next_comm, __entry->next_pid, __entry->next_prio) | 182 | __entry->next_comm, __entry->next_pid, __entry->next_prio) |
| 176 | ); | 183 | ); |
| 177 | 184 | ||
