X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fsched.h;h=25faad0e512914eb6f2d7093375c01ea0a4b263f;hb=090db00e2306c6ed56d0cdbc1273dca7dbfd9172;hp=4d30fe3e1acbb2eb74bff3e2f9c64db1a31fa788;hpb=7c68b363332170e4db100327ecc9e09b8a79cf29;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/sched.h b/instrumentation/events/lttng-module/sched.h index 4d30fe3e..25faad0e 100644 --- a/instrumentation/events/lttng-module/sched.h +++ b/instrumentation/events/lttng-module/sched.h @@ -8,6 +8,9 @@ #include #include #include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) +#include +#endif #ifndef _TRACE_SCHED_DEF_ #define _TRACE_SCHED_DEF_ @@ -327,7 +330,12 @@ TRACE_EVENT(sched_process_wait, ) /* - * Tracepoint for do_fork: + * Tracepoint for do_fork. + * Saving both TID and PID information, especially for the child, allows + * trace analyzers to distinguish between creation of a new process and + * creation of a new thread. Newly created processes will have child_tid + * == child_pid, while creation of a thread yields to child_tid != + * child_pid. */ TRACE_EVENT(sched_process_fork, @@ -338,15 +346,19 @@ TRACE_EVENT(sched_process_fork, TP_STRUCT__entry( __array_text( char, parent_comm, TASK_COMM_LEN ) __field( pid_t, parent_tid ) + __field( pid_t, parent_pid ) __array_text( char, child_comm, TASK_COMM_LEN ) __field( pid_t, child_tid ) + __field( pid_t, child_pid ) ), TP_fast_assign( tp_memcpy(parent_comm, parent->comm, TASK_COMM_LEN) tp_assign(parent_tid, parent->pid) + tp_assign(parent_pid, parent->tgid) tp_memcpy(child_comm, child->comm, TASK_COMM_LEN) tp_assign(child_tid, child->pid) + tp_assign(child_pid, child->tgid) ), TP_printk("comm=%s tid=%d child_comm=%s child_tid=%d",