History

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 ]

Steven Rostedt committed 17 years ago

Commit 937cdb91 parent be74b731 file · +8 −1Browse files

Unified · Split

include/trace/events/sched.h+8−1
@@ -156,6 +156,7 @@ TRACE_EVENT(sched_switch, · 155 unmodified lines
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, · 3 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t