759a783d4ed4dca62e43b277cc20c8ec1e91eb74
[lttng-modules.git] / instrumentation / events / lttng-module / workqueue.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM workqueue
3
4 #if !defined(LTTNG_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_WORKQUEUE_H
6
7 #include <probes/lttng-tracepoint-event.h>
8 #include <linux/workqueue.h>
9 #include <linux/version.h>
10
11 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
12
13 #ifndef _TRACE_WORKQUEUE_DEF_
14 #define _TRACE_WORKQUEUE_DEF_
15
16 struct worker;
17 struct global_cwq;
18
19 #endif
20
21 LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work,
22
23 TP_PROTO(struct work_struct *work),
24
25 TP_ARGS(work),
26
27 TP_FIELDS(
28 ctf_integer_hex(void *, work, work)
29 )
30 )
31
32 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
33 /**
34 * workqueue_queue_work - called when a work gets queued
35 * @req_cpu: the requested cpu
36 * @cwq: pointer to struct cpu_workqueue_struct
37 * @work: pointer to struct work_struct
38 *
39 * This event occurs when a work is queued immediately or once a
40 * delayed work is actually queued on a workqueue (ie: once the delay
41 * has been reached).
42 */
43 LTTNG_TRACEPOINT_EVENT(workqueue_queue_work,
44
45 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
46 TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq,
47 struct work_struct *work),
48
49 TP_ARGS(req_cpu, pwq, work),
50 #else
51 TP_PROTO(unsigned int req_cpu, struct cpu_workqueue_struct *cwq,
52 struct work_struct *work),
53
54 TP_ARGS(req_cpu, cwq, work),
55 #endif
56
57 TP_FIELDS(
58 ctf_integer_hex(void *, work, work)
59 ctf_integer_hex(void *, function, work->func)
60 ctf_integer(unsigned int, req_cpu, req_cpu)
61 )
62 )
63
64 /**
65 * workqueue_activate_work - called when a work gets activated
66 * @work: pointer to struct work_struct
67 *
68 * This event occurs when a queued work is put on the active queue,
69 * which happens immediately after queueing unless @max_active limit
70 * is reached.
71 */
72 LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_activate_work,
73
74 TP_PROTO(struct work_struct *work),
75
76 TP_ARGS(work)
77 )
78 #endif
79
80 /**
81 * workqueue_execute_start - called immediately before the workqueue callback
82 * @work: pointer to struct work_struct
83 *
84 * Allows to track workqueue execution.
85 */
86 LTTNG_TRACEPOINT_EVENT(workqueue_execute_start,
87
88 TP_PROTO(struct work_struct *work),
89
90 TP_ARGS(work),
91
92 TP_FIELDS(
93 ctf_integer_hex(void *, work, work)
94 ctf_integer_hex(void *, function, work->func)
95 )
96 )
97
98 /**
99 * workqueue_execute_end - called immediately after the workqueue callback
100 * @work: pointer to struct work_struct
101 *
102 * Allows to track workqueue execution.
103 */
104 LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_execute_end,
105
106 TP_PROTO(struct work_struct *work),
107
108 TP_ARGS(work)
109 )
110
111 #else
112
113 LTTNG_TRACEPOINT_EVENT_CLASS(workqueue,
114
115 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
116
117 TP_ARGS(wq_thread, work),
118
119 TP_FIELDS(
120 ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN)
121 ctf_integer(pid_t, thread_pid, wq_thread->pid)
122 ctf_integer_hex(work_func_t, func, work->func)
123 )
124 )
125
126 LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue, workqueue_insertion,
127
128 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
129
130 TP_ARGS(wq_thread, work)
131 )
132
133 LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue, workqueue_execution,
134
135 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
136
137 TP_ARGS(wq_thread, work)
138 )
139
140 /* Trace the creation of one workqueue thread on a cpu */
141 LTTNG_TRACEPOINT_EVENT(workqueue_creation,
142
143 TP_PROTO(struct task_struct *wq_thread, int cpu),
144
145 TP_ARGS(wq_thread, cpu),
146
147 TP_FIELDS(
148 ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN)
149 ctf_integer(pid_t, thread_pid, wq_thread->pid)
150 ctf_integer(int, cpu, cpu)
151 )
152 )
153
154 LTTNG_TRACEPOINT_EVENT(workqueue_destruction,
155
156 TP_PROTO(struct task_struct *wq_thread),
157
158 TP_ARGS(wq_thread),
159
160 TP_FIELDS(
161 ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN)
162 ctf_integer(pid_t, thread_pid, wq_thread->pid)
163 )
164 )
165
166 #endif
167
168 #endif /* LTTNG_TRACE_WORKQUEUE_H */
169
170 /* This part must be outside protection */
171 #include <probes/define_trace.h>
This page took 0.038483 seconds and 3 git commands to generate.