linuxlinux-kernelftrace

Ftrace. is task same as thread id?


I'm using ftrace. There is task/pid field. What is the task? Is it process's thread id? If no, is it possible to get information about threads with same pid with ftrace? I used only function and function_graph.


Solution

  • The PID column in the trace buffer corresponds to a thread : It is the value of the field named pid of structure task_struct (defined in sched.h).

    It is confusing for historical reasons but here pid is a unique identifier of a task (thread) : The basic entity scheduled by the kernel.

    One can say it is matching a process only if this process has only one thread, because a process PID is equal to the unique id of its main thread.