aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace/events/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace/events/sched.h')
-rw-r--r--include/trace/events/sched.h79
1 files changed, 33 insertions, 46 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index cfceb0b73e20..9208c92aeab5 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -50,44 +50,13 @@ TRACE_EVENT(sched_kthread_stop_ret,
50); 50);
51 51
52/* 52/*
53 * Tracepoint for waiting on task to unschedule:
54 *
55 * (NOTE: the 'rq' argument is not used by generic trace events,
56 * but used by the latency tracer plugin. )
57 */
58TRACE_EVENT(sched_wait_task,
59
60 TP_PROTO(struct rq *rq, struct task_struct *p),
61
62 TP_ARGS(rq, p),
63
64 TP_STRUCT__entry(
65 __array( char, comm, TASK_COMM_LEN )
66 __field( pid_t, pid )
67 __field( int, prio )
68 ),
69
70 TP_fast_assign(
71 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
72 __entry->pid = p->pid;
73 __entry->prio = p->prio;
74 ),
75
76 TP_printk("comm=%s pid=%d prio=%d",
77 __entry->comm, __entry->pid, __entry->prio)
78);
79
80/*
81 * Tracepoint for waking up a task: 53 * Tracepoint for waking up a task:
82 *
83 * (NOTE: the 'rq' argument is not used by generic trace events,
84 * but used by the latency tracer plugin. )
85 */ 54 */
86DECLARE_EVENT_CLASS(sched_wakeup_template, 55DECLARE_EVENT_CLASS(sched_wakeup_template,
87 56
88 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 57 TP_PROTO(struct task_struct *p, int success),
89 58
90 TP_ARGS(rq, p, success), 59 TP_ARGS(p, success),
91 60
92 TP_STRUCT__entry( 61 TP_STRUCT__entry(
93 __array( char, comm, TASK_COMM_LEN ) 62 __array( char, comm, TASK_COMM_LEN )
@@ -111,31 +80,42 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
111); 80);
112 81
113DEFINE_EVENT(sched_wakeup_template, sched_wakeup, 82DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
114 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 83 TP_PROTO(struct task_struct *p, int success),
115 TP_ARGS(rq, p, success)); 84 TP_ARGS(p, success));
116 85
117/* 86/*
118 * Tracepoint for waking up a new task: 87 * Tracepoint for waking up a new task:
119 *
120 * (NOTE: the 'rq' argument is not used by generic trace events,
121 * but used by the latency tracer plugin. )
122 */ 88 */
123DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, 89DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
124 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 90 TP_PROTO(struct task_struct *p, int success),
125 TP_ARGS(rq, p, success)); 91 TP_ARGS(p, success));
92
93#ifdef CREATE_TRACE_POINTS
94static inline long __trace_sched_switch_state(struct task_struct *p)
95{
96 long state = p->state;
97
98#ifdef CONFIG_PREEMPT
99 /*
100 * For all intents and purposes a preempted task is a running task.
101 */
102 if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE)
103 state = TASK_RUNNING;
104#endif
105
106 return state;
107}
108#endif
126 109
127/* 110/*
128 * Tracepoint for task switches, performed by the scheduler: 111 * Tracepoint for task switches, performed by the scheduler:
129 *
130 * (NOTE: the 'rq' argument is not used by generic trace events,
131 * but used by the latency tracer plugin. )
132 */ 112 */
133TRACE_EVENT(sched_switch, 113TRACE_EVENT(sched_switch,
134 114
135 TP_PROTO(struct rq *rq, struct task_struct *prev, 115 TP_PROTO(struct task_struct *prev,
136 struct task_struct *next), 116 struct task_struct *next),
137 117
138 TP_ARGS(rq, prev, next), 118 TP_ARGS(prev, next),
139 119
140 TP_STRUCT__entry( 120 TP_STRUCT__entry(
141 __array( char, prev_comm, TASK_COMM_LEN ) 121 __array( char, prev_comm, TASK_COMM_LEN )
@@ -151,7 +131,7 @@ TRACE_EVENT(sched_switch,
151 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); 131 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
152 __entry->prev_pid = prev->pid; 132 __entry->prev_pid = prev->pid;
153 __entry->prev_prio = prev->prio; 133 __entry->prev_prio = prev->prio;
154 __entry->prev_state = prev->state; 134 __entry->prev_state = __trace_sched_switch_state(prev);
155 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); 135 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
156 __entry->next_pid = next->pid; 136 __entry->next_pid = next->pid;
157 __entry->next_prio = next->prio; 137 __entry->next_prio = next->prio;
@@ -235,6 +215,13 @@ DEFINE_EVENT(sched_process_template, sched_process_exit,
235 TP_ARGS(p)); 215 TP_ARGS(p));
236 216
237/* 217/*
218 * Tracepoint for waiting on task to unschedule:
219 */
220DEFINE_EVENT(sched_process_template, sched_wait_task,
221 TP_PROTO(struct task_struct *p),
222 TP_ARGS(p));
223
224/*
238 * Tracepoint for a waiting task: 225 * Tracepoint for a waiting task:
239 */ 226 */
240TRACE_EVENT(sched_process_wait, 227TRACE_EVENT(sched_process_wait,