Commit | Line | Data |
---|---|---|
b87700e3 AG |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM workqueue | |
3 | ||
3bc29f0a MD |
4 | #if !defined(LTTNG_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ) |
5 | #define LTTNG_TRACE_WORKQUEUE_H | |
b87700e3 | 6 | |
6ec43db8 | 7 | #include <probes/lttng-tracepoint-event.h> |
b87700e3 AG |
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 | ||
b87700e3 AG |
19 | #endif |
20 | ||
3bc29f0a | 21 | LTTNG_TRACEPOINT_EVENT_CLASS(workqueue_work, |
b87700e3 AG |
22 | |
23 | TP_PROTO(struct work_struct *work), | |
24 | ||
25 | TP_ARGS(work), | |
26 | ||
f127e61e | 27 | TP_FIELDS( |
fa91fcac | 28 | ctf_integer_hex(void *, work, work) |
f127e61e | 29 | ) |
b87700e3 AG |
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 | */ | |
3bc29f0a | 43 | LTTNG_TRACEPOINT_EVENT(workqueue_queue_work, |
b87700e3 | 44 | |
20008d8c MD |
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 | |
b87700e3 AG |
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), | |
20008d8c | 55 | #endif |
b87700e3 | 56 | |
f127e61e | 57 | TP_FIELDS( |
fa91fcac MD |
58 | ctf_integer_hex(void *, work, work) |
59 | ctf_integer_hex(void *, function, work->func) | |
f127e61e MD |
60 | ctf_integer(unsigned int, req_cpu, req_cpu) |
61 | ) | |
b87700e3 AG |
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 | */ | |
3bc29f0a | 72 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_activate_work, |
b87700e3 AG |
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 | */ | |
3bc29f0a | 86 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_start, |
b87700e3 AG |
87 | |
88 | TP_PROTO(struct work_struct *work), | |
89 | ||
90 | TP_ARGS(work), | |
91 | ||
f127e61e | 92 | TP_FIELDS( |
fa91fcac MD |
93 | ctf_integer_hex(void *, work, work) |
94 | ctf_integer_hex(void *, function, work->func) | |
f127e61e | 95 | ) |
b87700e3 AG |
96 | ) |
97 | ||
85861846 MJ |
98 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) |
99 | /** | |
100 | * workqueue_execute_end - called immediately after the workqueue callback | |
101 | * @work: pointer to struct work_struct | |
102 | * @function: pointer to worker function | |
103 | * | |
104 | * Allows to track workqueue execution. | |
105 | */ | |
106 | LTTNG_TRACEPOINT_EVENT(workqueue_execute_end, | |
107 | ||
108 | TP_PROTO(struct work_struct *work, work_func_t function), | |
109 | ||
110 | TP_ARGS(work, function), | |
111 | ||
112 | TP_FIELDS( | |
113 | ctf_integer_hex(void *, work, work) | |
114 | ctf_integer_hex(void *, function, function) | |
115 | ) | |
116 | ) | |
117 | #else | |
b87700e3 AG |
118 | /** |
119 | * workqueue_execute_end - called immediately after the workqueue callback | |
120 | * @work: pointer to struct work_struct | |
121 | * | |
122 | * Allows to track workqueue execution. | |
123 | */ | |
3bc29f0a | 124 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue_work, workqueue_execute_end, |
b87700e3 AG |
125 | |
126 | TP_PROTO(struct work_struct *work), | |
127 | ||
128 | TP_ARGS(work) | |
129 | ) | |
85861846 | 130 | #endif |
b87700e3 AG |
131 | |
132 | #else | |
133 | ||
3bc29f0a | 134 | LTTNG_TRACEPOINT_EVENT_CLASS(workqueue, |
b87700e3 AG |
135 | |
136 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | |
137 | ||
138 | TP_ARGS(wq_thread, work), | |
139 | ||
f127e61e MD |
140 | TP_FIELDS( |
141 | ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) | |
142 | ctf_integer(pid_t, thread_pid, wq_thread->pid) | |
fa91fcac | 143 | ctf_integer_hex(work_func_t, func, work->func) |
f127e61e | 144 | ) |
b87700e3 AG |
145 | ) |
146 | ||
3bc29f0a | 147 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue, workqueue_insertion, |
b87700e3 AG |
148 | |
149 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | |
150 | ||
151 | TP_ARGS(wq_thread, work) | |
152 | ) | |
153 | ||
3bc29f0a | 154 | LTTNG_TRACEPOINT_EVENT_INSTANCE(workqueue, workqueue_execution, |
b87700e3 AG |
155 | |
156 | TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), | |
157 | ||
158 | TP_ARGS(wq_thread, work) | |
159 | ) | |
160 | ||
161 | /* Trace the creation of one workqueue thread on a cpu */ | |
3bc29f0a | 162 | LTTNG_TRACEPOINT_EVENT(workqueue_creation, |
b87700e3 AG |
163 | |
164 | TP_PROTO(struct task_struct *wq_thread, int cpu), | |
165 | ||
166 | TP_ARGS(wq_thread, cpu), | |
167 | ||
f127e61e MD |
168 | TP_FIELDS( |
169 | ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) | |
170 | ctf_integer(pid_t, thread_pid, wq_thread->pid) | |
171 | ctf_integer(int, cpu, cpu) | |
172 | ) | |
b87700e3 AG |
173 | ) |
174 | ||
3bc29f0a | 175 | LTTNG_TRACEPOINT_EVENT(workqueue_destruction, |
b87700e3 AG |
176 | |
177 | TP_PROTO(struct task_struct *wq_thread), | |
178 | ||
179 | TP_ARGS(wq_thread), | |
180 | ||
f127e61e MD |
181 | TP_FIELDS( |
182 | ctf_array(char, thread_comm, wq_thread->comm, TASK_COMM_LEN) | |
183 | ctf_integer(pid_t, thread_pid, wq_thread->pid) | |
184 | ) | |
b87700e3 AG |
185 | ) |
186 | ||
187 | #endif | |
188 | ||
3bc29f0a | 189 | #endif /* LTTNG_TRACE_WORKQUEUE_H */ |
b87700e3 AG |
190 | |
191 | /* This part must be outside protection */ | |
6ec43db8 | 192 | #include <probes/define_trace.h> |