Hi Paolo, On Thu, Mar 19, 2009 at 02:35:13PM +0100, Paolo wrote: > Hi! > I'm using ftrace in order to trace any task or process running. I'm > interesting to the context switch tracing. Ok, I've enabled sched_switch and > the results are in the trace file. > How can I interpretate correctly the results? > What does the following mean? > > bash-3997 [01] 240.132281: 3997:120:R + 4055:120:R > > The process 3997 (pid) with priority 120 is runnnig (R), right? > At the time 240.132281 the process 4055 wake up and.... > What does the R of the process 4055 mean? R: TASK_RUNNING S: TASK_INTERRUPTIBLE D: TASK_UNINTERRUPTIBLE TASK_RUNNING does not necessary means that the task is currently running on a cpu. It means that it is ready to run or running. TASK_INTERRUPTIBLE means that the task is sleeping, waiting for an event to wake it up. This event can be several things: a wake_up() on a wait_queue for example. In this state, a task will be awaken if a signal arrives for it. TASK_UNINTERRUPTIBLE: the same than INTERRUPTIBLE but it will not be awaken if a signal arrives. > > bash-3997 [01] 240.132284: 3997:120:R ==> 4055:120:R > > This is a real context witch, I suppose. Why is 3997 still running? > I believe that if there's a context switch, like in this case, the > process 3997 should sleep and 4055 starts to run. That's what will happen very soon. The current task is still 3997 but the context switch is currently performing. > > sleep-4055 [01] 240.132371: 4055:120:S ==> 3997:120:R > > This is the case that I said above, right? Here 4055 was running, but it put his state to TASK_INTERRUPTIBLE and called schedule(), then 3997 has been chosen to become the next current task. > > bash-3997 [01] 240.132454: 3997:120:R + 4055:120:S > > 4005 wake up and it goes to sleep, right? waking up a task does not neccesary means that the task will be run just after. Here, 4055 will change its state from S to R, and will then become eligible to be run soon. > > sleep-4055 [01] 240.132460: 4055:120: D ==> 3997:120:R > > What is D? > > bash-3997 [01] 240.132463: 3997:120:R + 4055:120: D > > 4005 wakes up and goes in the state.... I don't know 4005 wakes up and changes its state from D to R, will become eligible :-) > The documentation says that the R state is: > the process wants to run, may not actually be running. > Is it running or not? How can I know if it's running? Yeah, that's what I explained above. TASK_RUNNING only means that the task is eligible to be chosen by the scheduler to be run. It can be running or not, depending of the scheduler's choice. > > Help me. > Thanks I hope it helps, don't hesitate if you have another question :-) Frederic. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ