Fix: update sched instrumentation for 3.19+ kernels
[lttng-modules.git] / instrumentation / events / lttng-module / sched.h
CommitLineData
f62b389e
MD
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM sched
3
3bc29f0a
MD
4#if !defined(LTTNG_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
5#define LTTNG_TRACE_SCHED_H
f62b389e 6
3bc29f0a 7#include "../../../probes/lttng-tracepoint-event.h"
f62b389e 8#include <linux/sched.h>
7c68b363
AG
9#include <linux/binfmts.h>
10#include <linux/version.h>
090db00e
MJ
11#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
12#include <linux/sched/rt.h>
13#endif
f62b389e
MD
14
15#ifndef _TRACE_SCHED_DEF_
16#define _TRACE_SCHED_DEF_
17
2a5c234d
MD
18#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
19
20static inline long __trace_sched_switch_state(struct task_struct *p)
21{
22 long state = p->state;
23
24#ifdef CONFIG_PREEMPT
25#ifdef CONFIG_SCHED_DEBUG
26 BUG_ON(p != current);
27#endif /* CONFIG_SCHED_DEBUG */
28 /*
29 * For all intents and purposes a preempted task is a running task.
30 */
31 if (preempt_count() & PREEMPT_ACTIVE)
32 state = TASK_RUNNING | TASK_STATE_MAX;
33#endif /* CONFIG_PREEMPT */
34
35 return state;
36}
37
38#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
33673ee7
MD
39
40static inline long __trace_sched_switch_state(struct task_struct *p)
41{
42 long state = p->state;
43
44#ifdef CONFIG_PREEMPT
45 /*
46 * For all intents and purposes a preempted task is a running task.
47 */
48 if (task_preempt_count(p) & PREEMPT_ACTIVE)
49 state = TASK_RUNNING | TASK_STATE_MAX;
50#endif
51
52 return state;
53}
54
55#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
7c68b363 56
f62b389e
MD
57static inline long __trace_sched_switch_state(struct task_struct *p)
58{
59 long state = p->state;
60
61#ifdef CONFIG_PREEMPT
62 /*
63 * For all intents and purposes a preempted task is a running task.
64 */
65 if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE)
7c68b363 66 state = TASK_RUNNING | TASK_STATE_MAX;
7c68b363 67#endif
33673ee7
MD
68
69 return state;
70}
71
72#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
73
74static inline long __trace_sched_switch_state(struct task_struct *p)
75{
76 long state = p->state;
77
78#ifdef CONFIG_PREEMPT
79 /*
80 * For all intents and purposes a preempted task is a running task.
81 */
82 if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE)
83 state = TASK_RUNNING;
f62b389e
MD
84#endif
85
86 return state;
87}
88
7c68b363
AG
89#endif
90
f62b389e
MD
91#endif /* _TRACE_SCHED_DEF_ */
92
93/*
94 * Tracepoint for calling kthread_stop, performed to end a kthread:
95 */
3bc29f0a 96LTTNG_TRACEPOINT_EVENT(sched_kthread_stop,
f62b389e
MD
97
98 TP_PROTO(struct task_struct *t),
99
100 TP_ARGS(t),
101
102 TP_STRUCT__entry(
64c796d8 103 __array_text( char, comm, TASK_COMM_LEN )
e5092131 104 __field( pid_t, tid )
f62b389e
MD
105 ),
106
107 TP_fast_assign(
108 tp_memcpy(comm, t->comm, TASK_COMM_LEN)
e5092131 109 tp_assign(tid, t->pid)
f62b389e
MD
110 ),
111
e5092131 112 TP_printk("comm=%s tid=%d", __entry->comm, __entry->tid)
f62b389e
MD
113)
114
115/*
116 * Tracepoint for the return value of the kthread stopping:
117 */
3bc29f0a 118LTTNG_TRACEPOINT_EVENT(sched_kthread_stop_ret,
f62b389e
MD
119
120 TP_PROTO(int ret),
121
122 TP_ARGS(ret),
123
124 TP_STRUCT__entry(
125 __field( int, ret )
126 ),
127
128 TP_fast_assign(
129 tp_assign(ret, ret)
130 ),
131
132 TP_printk("ret=%d", __entry->ret)
133)
134
135/*
136 * Tracepoint for waking up a task:
137 */
3bc29f0a 138LTTNG_TRACEPOINT_EVENT_CLASS(sched_wakeup_template,
f62b389e 139
3a523f5b 140#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
f62b389e
MD
141 TP_PROTO(struct task_struct *p, int success),
142
143 TP_ARGS(p, success),
3a523f5b
MD
144#else
145 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
146
147 TP_ARGS(rq, p, success),
148#endif
f62b389e
MD
149
150 TP_STRUCT__entry(
64c796d8 151 __array_text( char, comm, TASK_COMM_LEN )
e5092131 152 __field( pid_t, tid )
f62b389e
MD
153 __field( int, prio )
154 __field( int, success )
7c68b363 155#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
f62b389e 156 __field( int, target_cpu )
7c68b363 157#endif
f62b389e
MD
158 ),
159
160 TP_fast_assign(
161 tp_memcpy(comm, p->comm, TASK_COMM_LEN)
e5092131 162 tp_assign(tid, p->pid)
f62b389e
MD
163 tp_assign(prio, p->prio)
164 tp_assign(success, success)
7c68b363 165#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
f62b389e 166 tp_assign(target_cpu, task_cpu(p))
7c68b363
AG
167#endif
168#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
169 )
170 TP_perf_assign(
171 __perf_task(p)
172#endif
f62b389e
MD
173 ),
174
7c68b363 175#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
e5092131
MD
176 TP_printk("comm=%s tid=%d prio=%d success=%d target_cpu=%03d",
177 __entry->comm, __entry->tid, __entry->prio,
f62b389e 178 __entry->success, __entry->target_cpu)
7c68b363
AG
179#else
180 TP_printk("comm=%s tid=%d prio=%d success=%d",
181 __entry->comm, __entry->tid, __entry->prio,
182 __entry->success)
183#endif
f62b389e
MD
184)
185
3a523f5b
MD
186#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
187
3bc29f0a 188LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup,
f62b389e
MD
189 TP_PROTO(struct task_struct *p, int success),
190 TP_ARGS(p, success))
191
192/*
193 * Tracepoint for waking up a new task:
194 */
3bc29f0a 195LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup_new,
f62b389e
MD
196 TP_PROTO(struct task_struct *p, int success),
197 TP_ARGS(p, success))
198
3a523f5b
MD
199#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
200
3bc29f0a 201LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup,
3a523f5b
MD
202 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
203 TP_ARGS(rq, p, success))
204
205/*
206 * Tracepoint for waking up a new task:
207 */
3bc29f0a 208LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_wakeup_template, sched_wakeup_new,
3a523f5b
MD
209 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
210 TP_ARGS(rq, p, success))
211
212#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
213
f62b389e
MD
214/*
215 * Tracepoint for task switches, performed by the scheduler:
216 */
3bc29f0a 217LTTNG_TRACEPOINT_EVENT(sched_switch,
f62b389e 218
3a523f5b 219#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
f62b389e
MD
220 TP_PROTO(struct task_struct *prev,
221 struct task_struct *next),
222
223 TP_ARGS(prev, next),
3a523f5b
MD
224#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
225 TP_PROTO(struct rq *rq, struct task_struct *prev,
226 struct task_struct *next),
227
228 TP_ARGS(rq, prev, next),
229#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
f62b389e
MD
230
231 TP_STRUCT__entry(
64c796d8 232 __array_text( char, prev_comm, TASK_COMM_LEN )
e5092131 233 __field( pid_t, prev_tid )
f62b389e
MD
234 __field( int, prev_prio )
235 __field( long, prev_state )
64c796d8 236 __array_text( char, next_comm, TASK_COMM_LEN )
e5092131 237 __field( pid_t, next_tid )
f62b389e
MD
238 __field( int, next_prio )
239 ),
240
241 TP_fast_assign(
242 tp_memcpy(next_comm, next->comm, TASK_COMM_LEN)
e5092131 243 tp_assign(prev_tid, prev->pid)
3568c28c 244 tp_assign(prev_prio, prev->prio - MAX_RT_PRIO)
7c68b363 245#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
f62b389e 246 tp_assign(prev_state, __trace_sched_switch_state(prev))
7c68b363
AG
247#else
248 tp_assign(prev_state, prev->state)
249#endif
f62b389e 250 tp_memcpy(prev_comm, prev->comm, TASK_COMM_LEN)
e5092131 251 tp_assign(next_tid, next->pid)
3568c28c 252 tp_assign(next_prio, next->prio - MAX_RT_PRIO)
f62b389e
MD
253 ),
254
7c68b363
AG
255#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
256 TP_printk("prev_comm=%s prev_tid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_tid=%d next_prio=%d",
257 __entry->prev_comm, __entry->prev_tid, __entry->prev_prio,
258 __entry->prev_state & (TASK_STATE_MAX-1) ?
259 __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|",
260 { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
261 { 16, "Z" }, { 32, "X" }, { 64, "x" },
262 { 128, "W" }) : "R",
263 __entry->prev_state & TASK_STATE_MAX ? "+" : "",
264 __entry->next_comm, __entry->next_tid, __entry->next_prio)
265#else
e5092131
MD
266 TP_printk("prev_comm=%s prev_tid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_tid=%d next_prio=%d",
267 __entry->prev_comm, __entry->prev_tid, __entry->prev_prio,
f62b389e
MD
268 __entry->prev_state ?
269 __print_flags(__entry->prev_state, "|",
270 { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
271 { 16, "Z" }, { 32, "X" }, { 64, "x" },
272 { 128, "W" }) : "R",
e5092131 273 __entry->next_comm, __entry->next_tid, __entry->next_prio)
7c68b363 274#endif
f62b389e
MD
275)
276
277/*
278 * Tracepoint for a task being migrated:
279 */
3bc29f0a 280LTTNG_TRACEPOINT_EVENT(sched_migrate_task,
f62b389e
MD
281
282 TP_PROTO(struct task_struct *p, int dest_cpu),
283
284 TP_ARGS(p, dest_cpu),
285
286 TP_STRUCT__entry(
64c796d8 287 __array_text( char, comm, TASK_COMM_LEN )
e5092131 288 __field( pid_t, tid )
f62b389e
MD
289 __field( int, prio )
290 __field( int, orig_cpu )
291 __field( int, dest_cpu )
292 ),
293
294 TP_fast_assign(
295 tp_memcpy(comm, p->comm, TASK_COMM_LEN)
e5092131 296 tp_assign(tid, p->pid)
3568c28c 297 tp_assign(prio, p->prio - MAX_RT_PRIO)
f62b389e
MD
298 tp_assign(orig_cpu, task_cpu(p))
299 tp_assign(dest_cpu, dest_cpu)
300 ),
301
e5092131
MD
302 TP_printk("comm=%s tid=%d prio=%d orig_cpu=%d dest_cpu=%d",
303 __entry->comm, __entry->tid, __entry->prio,
f62b389e
MD
304 __entry->orig_cpu, __entry->dest_cpu)
305)
306
3bc29f0a 307LTTNG_TRACEPOINT_EVENT_CLASS(sched_process_template,
f62b389e
MD
308
309 TP_PROTO(struct task_struct *p),
310
311 TP_ARGS(p),
312
313 TP_STRUCT__entry(
64c796d8 314 __array_text( char, comm, TASK_COMM_LEN )
e5092131 315 __field( pid_t, tid )
f62b389e
MD
316 __field( int, prio )
317 ),
318
319 TP_fast_assign(
320 tp_memcpy(comm, p->comm, TASK_COMM_LEN)
e5092131 321 tp_assign(tid, p->pid)
3568c28c 322 tp_assign(prio, p->prio - MAX_RT_PRIO)
f62b389e
MD
323 ),
324
e5092131
MD
325 TP_printk("comm=%s tid=%d prio=%d",
326 __entry->comm, __entry->tid, __entry->prio)
f62b389e
MD
327)
328
329/*
330 * Tracepoint for freeing a task:
331 */
3bc29f0a 332LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_process_template, sched_process_free,
f62b389e
MD
333 TP_PROTO(struct task_struct *p),
334 TP_ARGS(p))
335
336
337/*
338 * Tracepoint for a task exiting:
339 */
3bc29f0a 340LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_process_template, sched_process_exit,
f62b389e
MD
341 TP_PROTO(struct task_struct *p),
342 TP_ARGS(p))
343
344/*
345 * Tracepoint for waiting on task to unschedule:
346 */
3a523f5b 347#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
3bc29f0a 348LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_process_template, sched_wait_task,
f62b389e
MD
349 TP_PROTO(struct task_struct *p),
350 TP_ARGS(p))
3a523f5b 351#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
3bc29f0a 352LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_process_template, sched_wait_task,
3a523f5b
MD
353 TP_PROTO(struct rq *rq, struct task_struct *p),
354 TP_ARGS(rq, p))
355#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */
f62b389e
MD
356
357/*
358 * Tracepoint for a waiting task:
359 */
3bc29f0a 360LTTNG_TRACEPOINT_EVENT(sched_process_wait,
f62b389e
MD
361
362 TP_PROTO(struct pid *pid),
363
364 TP_ARGS(pid),
365
366 TP_STRUCT__entry(
64c796d8 367 __array_text( char, comm, TASK_COMM_LEN )
e5092131 368 __field( pid_t, tid )
f62b389e
MD
369 __field( int, prio )
370 ),
371
372 TP_fast_assign(
373 tp_memcpy(comm, current->comm, TASK_COMM_LEN)
e5092131 374 tp_assign(tid, pid_nr(pid))
3568c28c 375 tp_assign(prio, current->prio - MAX_RT_PRIO)
f62b389e
MD
376 ),
377
e5092131
MD
378 TP_printk("comm=%s tid=%d prio=%d",
379 __entry->comm, __entry->tid, __entry->prio)
f62b389e
MD
380)
381
382/*
79b18ef7
MD
383 * Tracepoint for do_fork.
384 * Saving both TID and PID information, especially for the child, allows
385 * trace analyzers to distinguish between creation of a new process and
386 * creation of a new thread. Newly created processes will have child_tid
387 * == child_pid, while creation of a thread yields to child_tid !=
388 * child_pid.
f62b389e 389 */
3bc29f0a 390LTTNG_TRACEPOINT_EVENT(sched_process_fork,
f62b389e
MD
391
392 TP_PROTO(struct task_struct *parent, struct task_struct *child),
393
394 TP_ARGS(parent, child),
395
396 TP_STRUCT__entry(
64c796d8 397 __array_text( char, parent_comm, TASK_COMM_LEN )
e5092131 398 __field( pid_t, parent_tid )
79b18ef7 399 __field( pid_t, parent_pid )
64c796d8 400 __array_text( char, child_comm, TASK_COMM_LEN )
e5092131 401 __field( pid_t, child_tid )
79b18ef7 402 __field( pid_t, child_pid )
f62b389e
MD
403 ),
404
405 TP_fast_assign(
406 tp_memcpy(parent_comm, parent->comm, TASK_COMM_LEN)
e5092131 407 tp_assign(parent_tid, parent->pid)
79b18ef7 408 tp_assign(parent_pid, parent->tgid)
f62b389e 409 tp_memcpy(child_comm, child->comm, TASK_COMM_LEN)
e5092131 410 tp_assign(child_tid, child->pid)
79b18ef7 411 tp_assign(child_pid, child->tgid)
f62b389e
MD
412 ),
413
e5092131
MD
414 TP_printk("comm=%s tid=%d child_comm=%s child_tid=%d",
415 __entry->parent_comm, __entry->parent_tid,
416 __entry->child_comm, __entry->child_tid)
f62b389e
MD
417)
418
7c68b363
AG
419#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
420/*
421 * Tracepoint for sending a signal:
422 */
3bc29f0a 423LTTNG_TRACEPOINT_EVENT(sched_signal_send,
7c68b363
AG
424
425 TP_PROTO(int sig, struct task_struct *p),
426
427 TP_ARGS(sig, p),
428
429 TP_STRUCT__entry(
430 __field( int, sig )
431 __array( char, comm, TASK_COMM_LEN )
432 __field( pid_t, pid )
433 ),
434
435 TP_fast_assign(
436 tp_memcpy(comm, p->comm, TASK_COMM_LEN)
437 tp_assign(pid, p->pid)
438 tp_assign(sig, sig)
439 ),
440
441 TP_printk("sig=%d comm=%s pid=%d",
442 __entry->sig, __entry->comm, __entry->pid)
443)
444#endif
445
c94b2508 446#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
46142a81
PW
447/*
448 * Tracepoint for exec:
449 */
3bc29f0a 450LTTNG_TRACEPOINT_EVENT(sched_process_exec,
46142a81
PW
451
452 TP_PROTO(struct task_struct *p, pid_t old_pid,
453 struct linux_binprm *bprm),
454
455 TP_ARGS(p, old_pid, bprm),
456
457 TP_STRUCT__entry(
458 __string( filename, bprm->filename )
e7b0901e
AG
459 __field( pid_t, tid )
460 __field( pid_t, old_tid )
46142a81
PW
461 ),
462
463 TP_fast_assign(
464 tp_strcpy(filename, bprm->filename)
e7b0901e
AG
465 tp_assign(tid, p->pid)
466 tp_assign(old_tid, old_pid)
46142a81
PW
467 ),
468
e7b0901e
AG
469 TP_printk("filename=%s tid=%d old_tid=%d", __get_str(filename),
470 __entry->tid, __entry->old_tid)
46142a81 471)
c94b2508 472#endif
46142a81 473
7c68b363 474#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
f62b389e
MD
475/*
476 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
477 * adding sched_stat support to SCHED_FIFO/RR would be welcome.
478 */
3bc29f0a 479LTTNG_TRACEPOINT_EVENT_CLASS(sched_stat_template,
f62b389e
MD
480
481 TP_PROTO(struct task_struct *tsk, u64 delay),
482
483 TP_ARGS(tsk, delay),
484
485 TP_STRUCT__entry(
64c796d8 486 __array_text( char, comm, TASK_COMM_LEN )
e5092131 487 __field( pid_t, tid )
f62b389e
MD
488 __field( u64, delay )
489 ),
490
491 TP_fast_assign(
492 tp_memcpy(comm, tsk->comm, TASK_COMM_LEN)
e5092131 493 tp_assign(tid, tsk->pid)
f62b389e
MD
494 tp_assign(delay, delay)
495 )
496 TP_perf_assign(
497 __perf_count(delay)
498 ),
499
e5092131
MD
500 TP_printk("comm=%s tid=%d delay=%Lu [ns]",
501 __entry->comm, __entry->tid,
f62b389e
MD
502 (unsigned long long)__entry->delay)
503)
504
505
506/*
507 * Tracepoint for accounting wait time (time the task is runnable
508 * but not actually running due to scheduler contention).
509 */
3bc29f0a 510LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_stat_template, sched_stat_wait,
f62b389e
MD
511 TP_PROTO(struct task_struct *tsk, u64 delay),
512 TP_ARGS(tsk, delay))
513
514/*
515 * Tracepoint for accounting sleep time (time the task is not runnable,
516 * including iowait, see below).
517 */
3bc29f0a 518LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_stat_template, sched_stat_sleep,
f62b389e
MD
519 TP_PROTO(struct task_struct *tsk, u64 delay),
520 TP_ARGS(tsk, delay))
521
522/*
523 * Tracepoint for accounting iowait time (time the task is not runnable
524 * due to waiting on IO to complete).
525 */
3bc29f0a 526LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_stat_template, sched_stat_iowait,
f62b389e
MD
527 TP_PROTO(struct task_struct *tsk, u64 delay),
528 TP_ARGS(tsk, delay))
529
7c68b363
AG
530#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
531/*
532 * Tracepoint for accounting blocked time (time the task is in uninterruptible).
533 */
3bc29f0a 534LTTNG_TRACEPOINT_EVENT_INSTANCE(sched_stat_template, sched_stat_blocked,
7c68b363
AG
535 TP_PROTO(struct task_struct *tsk, u64 delay),
536 TP_ARGS(tsk, delay))
537#endif
538
f62b389e
MD
539/*
540 * Tracepoint for accounting runtime (time the task is executing
541 * on a CPU).
542 */
3bc29f0a 543LTTNG_TRACEPOINT_EVENT(sched_stat_runtime,
f62b389e
MD
544
545 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
546
547 TP_ARGS(tsk, runtime, vruntime),
548
549 TP_STRUCT__entry(
64c796d8 550 __array_text( char, comm, TASK_COMM_LEN )
e5092131 551 __field( pid_t, tid )
f62b389e
MD
552 __field( u64, runtime )
553 __field( u64, vruntime )
554 ),
555
556 TP_fast_assign(
557 tp_memcpy(comm, tsk->comm, TASK_COMM_LEN)
e5092131 558 tp_assign(tid, tsk->pid)
f62b389e
MD
559 tp_assign(runtime, runtime)
560 tp_assign(vruntime, vruntime)
561 )
562 TP_perf_assign(
563 __perf_count(runtime)
7c68b363
AG
564#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
565 __perf_task(tsk)
566#endif
f62b389e
MD
567 ),
568
e5092131
MD
569 TP_printk("comm=%s tid=%d runtime=%Lu [ns] vruntime=%Lu [ns]",
570 __entry->comm, __entry->tid,
f62b389e
MD
571 (unsigned long long)__entry->runtime,
572 (unsigned long long)__entry->vruntime)
573)
7c68b363 574#endif
f62b389e 575
7c68b363 576#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
f62b389e
MD
577/*
578 * Tracepoint for showing priority inheritance modifying a tasks
579 * priority.
580 */
3bc29f0a 581LTTNG_TRACEPOINT_EVENT(sched_pi_setprio,
f62b389e
MD
582
583 TP_PROTO(struct task_struct *tsk, int newprio),
584
585 TP_ARGS(tsk, newprio),
586
587 TP_STRUCT__entry(
64c796d8 588 __array_text( char, comm, TASK_COMM_LEN )
e5092131 589 __field( pid_t, tid )
f62b389e
MD
590 __field( int, oldprio )
591 __field( int, newprio )
592 ),
593
594 TP_fast_assign(
595 tp_memcpy(comm, tsk->comm, TASK_COMM_LEN)
e5092131 596 tp_assign(tid, tsk->pid)
3568c28c
MD
597 tp_assign(oldprio, tsk->prio - MAX_RT_PRIO)
598 tp_assign(newprio, newprio - MAX_RT_PRIO)
f62b389e
MD
599 ),
600
e5092131
MD
601 TP_printk("comm=%s tid=%d oldprio=%d newprio=%d",
602 __entry->comm, __entry->tid,
f62b389e
MD
603 __entry->oldprio, __entry->newprio)
604)
7c68b363 605#endif
f62b389e 606
3bc29f0a 607#endif /* LTTNG_TRACE_SCHED_H */
f62b389e
MD
608
609/* This part must be outside protection */
5b88d86e 610#include "../../../probes/define_trace.h"
This page took 0.05807 seconds and 4 git commands to generate.