X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fsched.h;h=f6b65ae2e98ad36651588accabe3504b1c8241af;hb=c93180196ea8d4895e8b68f322ca52d91961481a;hp=6b3b033579bc1146e74f5547ee6cc8fb1d5dc81a;hpb=3bc29f0a41b3c803245b845db2e1909042e72e9c;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/sched.h b/instrumentation/events/lttng-module/sched.h index 6b3b0335..f6b65ae2 100644 --- a/instrumentation/events/lttng-module/sched.h +++ b/instrumentation/events/lttng-module/sched.h @@ -15,7 +15,27 @@ #ifndef _TRACE_SCHED_DEF_ #define _TRACE_SCHED_DEF_ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)) + +static inline long __trace_sched_switch_state(struct task_struct *p) +{ + long state = p->state; + +#ifdef CONFIG_PREEMPT +#ifdef CONFIG_SCHED_DEBUG + BUG_ON(p != current); +#endif /* CONFIG_SCHED_DEBUG */ + /* + * For all intents and purposes a preempted task is a running task. + */ + if (preempt_count() & PREEMPT_ACTIVE) + state = TASK_RUNNING | TASK_STATE_MAX; +#endif /* CONFIG_PREEMPT */ + + return state; +} + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) static inline long __trace_sched_switch_state(struct task_struct *p) { @@ -115,6 +135,21 @@ LTTNG_TRACEPOINT_EVENT(sched_kthread_stop_ret, /* * Tracepoint for waking up a task: */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) +LTTNG_TRACEPOINT_EVENT_CLASS(sched_wakeup_template, + + TP_PROTO(struct task_struct *p), + + TP_ARGS(p), + + TP_FIELDS( + ctf_array_text(char, comm, p->comm, TASK_COMM_LEN) + ctf_integer(pid_t, tid, p->pid) + ctf_integer(int, prio, p->prio) + ctf_integer(int, target_cpu, task_cpu(p)) + ) +) +#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ LTTNG_TRACEPOINT_EVENT_CLASS(sched_wakeup_template, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) @@ -162,8 +197,34 @@ LTTNG_TRACEPOINT_EVENT_CLASS(sched_wakeup_template, __entry->success) #endif ) +#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) + +/* + * Tracepoint called when waking a task; this tracepoint is guaranteed to be + * called from the waking context. + */ +LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_waking, + TP_PROTO(struct task_struct *p), + TP_ARGS(p)) + +/* + * Tracepoint called when the task is actually woken; p->state == TASK_RUNNNG. + * It it not always called from the waking context. + */ +LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup, + TP_PROTO(struct task_struct *p), + TP_ARGS(p)) + +/* + * Tracepoint for waking up a new task: + */ +LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup_new, + TP_PROTO(struct task_struct *p), + TP_ARGS(p)) + +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup, TP_PROTO(struct task_struct *p, int success),