- TP_STRUCT__entry(
- __array_text( char, prev_comm, TASK_COMM_LEN )
- __field( pid_t, prev_tid )
- __field( int, prev_prio )
- __field( long, prev_state )
- __array_text( char, next_comm, TASK_COMM_LEN )
- __field( pid_t, next_tid )
- __field( int, next_prio )
- ),
-
- TP_fast_assign(
- tp_memcpy(next_comm, next->comm, TASK_COMM_LEN)
- tp_assign(prev_tid, prev->pid)
- tp_assign(prev_prio, prev->prio - MAX_RT_PRIO)
- tp_assign(prev_state, __trace_sched_switch_state(prev))
- tp_memcpy(prev_comm, prev->comm, TASK_COMM_LEN)
- tp_assign(next_tid, next->pid)
- tp_assign(next_prio, next->prio - MAX_RT_PRIO)
- ),
-
- TP_printk("prev_comm=%s prev_tid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_tid=%d next_prio=%d",
- __entry->prev_comm, __entry->prev_tid, __entry->prev_prio,
- __entry->prev_state ?
- __print_flags(__entry->prev_state, "|",
- { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
- { 16, "Z" }, { 32, "X" }, { 64, "x" },
- { 128, "W" }) : "R",
- __entry->next_comm, __entry->next_tid, __entry->next_prio)
+ TP_FIELDS(
+ ctf_array_text(char, prev_comm, prev->comm, TASK_COMM_LEN)
+ ctf_integer(pid_t, prev_tid, prev->pid)
+ ctf_integer(int, prev_prio, prev->prio - MAX_RT_PRIO)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0))
+ ctf_integer(long, prev_state, __trace_sched_switch_state(preempt, prev))
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ctf_integer(long, prev_state, __trace_sched_switch_state(prev))
+#else
+ ctf_integer(long, prev_state, prev->state)
+#endif
+ ctf_array_text(char, next_comm, next->comm, TASK_COMM_LEN)
+ ctf_integer(pid_t, next_tid, next->pid)
+ ctf_integer(int, next_prio, next->prio - MAX_RT_PRIO)
+ )