sunrpc: introduce lttng_get_clid helper
[lttng-modules.git] / instrumentation / events / lttng-module / rpc.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM rpc
3
4 #if !defined(LTTNG_TRACE_RPC_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_RPC_H
6
7 #include <probes/lttng-tracepoint-event.h>
8 #include <linux/sunrpc/sched.h>
9 #include <linux/sunrpc/clnt.h>
10
11 #ifndef ONCE_LTTNG_RPC_H
12 #define ONCE_LTTNG_RPC_H
13
14 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
15 static inline
16 int lttng_get_clid(const struct rpc_task *task)
17 {
18 struct rpc_clnt *tk_client;
19
20 tk_client = task->tk_client;
21 if (!tk_client)
22 return -1;
23 /*
24 * The cl_clid field is always initialized to positive signed
25 * integers. Negative signed integer values are treated as
26 * errors.
27 */
28 return (int) tk_client->cl_clid;
29 }
30 #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
31
32 #endif /* ONCE_LTTNG_RPC_H */
33
34 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0))
35 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status,
36
37 TP_PROTO(const struct rpc_task *task),
38
39 TP_ARGS(task),
40
41 TP_FIELDS(
42 ctf_integer(unsigned int, task_id, task->tk_pid)
43 ctf_integer(int, client_id, lttng_get_clid(task))
44 ctf_integer(int, status, task->tk_status)
45 )
46 )
47
48 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status,
49 TP_PROTO(const struct rpc_task *task),
50
51 TP_ARGS(task)
52 )
53
54 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status,
55 TP_PROTO(const struct rpc_task *task),
56
57 TP_ARGS(task)
58 )
59 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
60 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status,
61
62 TP_PROTO(struct rpc_task *task),
63
64 TP_ARGS(task),
65
66 TP_FIELDS(
67 ctf_integer(unsigned int, task_id, task->tk_pid)
68 ctf_integer(int, client_id, lttng_get_clid(task))
69 ctf_integer(int, status, task->tk_status)
70 )
71 )
72
73 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status,
74 TP_PROTO(struct rpc_task *task),
75
76 TP_ARGS(task)
77 )
78
79 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status,
80 TP_PROTO(struct rpc_task *task),
81
82 TP_ARGS(task)
83 )
84 #else
85 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status,
86
87 TP_PROTO(struct rpc_task *task),
88
89 TP_ARGS(task),
90
91 TP_FIELDS(
92 ctf_integer_hex(const struct rpc_task *, task, task)
93 ctf_integer_hex(const struct rpc_clnt *, clnt, task->tk_client)
94 ctf_integer(int, status, task->tk_status)
95 )
96 )
97
98 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status,
99 TP_PROTO(struct rpc_task *task),
100
101 TP_ARGS(task)
102 )
103
104 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status,
105 TP_PROTO(struct rpc_task *task),
106
107 TP_ARGS(task)
108 )
109 #endif
110
111 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0))
112 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_connect_status,
113 TP_PROTO(const struct rpc_task *task),
114
115 TP_ARGS(task)
116 )
117 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0))
118 LTTNG_TRACEPOINT_EVENT(rpc_connect_status,
119 TP_PROTO(const struct rpc_task *task),
120
121 TP_ARGS(task),
122
123 TP_FIELDS(
124 ctf_integer(unsigned int, task_id, task->tk_pid)
125 ctf_integer(int, client_id, lttng_get_clid(task))
126 ctf_integer(int, status, task->tk_status)
127 )
128 )
129 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
130 LTTNG_TRACEPOINT_EVENT(rpc_connect_status,
131 TP_PROTO(struct rpc_task *task, int status),
132
133 TP_ARGS(task, status),
134
135 TP_FIELDS(
136 ctf_integer(unsigned int, task_id, task->tk_pid)
137 ctf_integer(int, client_id, lttng_get_clid(task))
138 ctf_integer(int, status, status)
139 )
140 )
141 #else
142 LTTNG_TRACEPOINT_EVENT(rpc_connect_status,
143 TP_PROTO(struct rpc_task *task, int status),
144
145 TP_ARGS(task, status),
146
147 TP_FIELDS(
148 ctf_integer_hex(const struct rpc_task *, task, task)
149 ctf_integer_hex(const struct rpc_clnt *, clnt, task->tk_client)
150 ctf_integer(int, status, status)
151 )
152 )
153 #endif
154
155 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0))
156 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
157
158 TP_PROTO(const struct rpc_task *task, const void *action),
159
160 TP_ARGS(task, action),
161
162 TP_FIELDS(
163 ctf_integer(unsigned int, task_id, task->tk_pid)
164 ctf_integer(int, client_id, lttng_get_clid(task))
165 ctf_integer_hex(const void *, action, action)
166 ctf_integer(unsigned long, runstate, task->tk_runstate)
167 ctf_integer(int, status, task->tk_status)
168 ctf_integer(unsigned short, flags, task->tk_flags)
169 )
170 )
171
172 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin,
173
174 TP_PROTO(const struct rpc_task *task, const void *action),
175
176 TP_ARGS(task, action)
177 )
178
179 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action,
180
181 TP_PROTO(const struct rpc_task *task, const void *action),
182
183 TP_ARGS(task, action)
184 )
185
186 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete,
187
188 TP_PROTO(const struct rpc_task *task, const void *action),
189
190 TP_ARGS(task, action)
191 )
192
193 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued,
194
195 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
196
197 TP_ARGS(task, q),
198
199 TP_FIELDS(
200 ctf_integer(unsigned int, task_id, task->tk_pid)
201 ctf_integer(int, client_id, lttng_get_clid(task))
202 ctf_integer(unsigned long, timeout, task->tk_timeout)
203 ctf_integer(unsigned long, runstate, task->tk_runstate)
204 ctf_integer(int, status, task->tk_status)
205 ctf_integer(unsigned short, flags, task->tk_flags)
206 ctf_string(q_name, rpc_qname(q))
207 )
208 )
209
210 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep,
211
212 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
213
214 TP_ARGS(task, q)
215 )
216
217 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup,
218
219 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
220
221 TP_ARGS(task, q)
222 )
223
224 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
225 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
226
227 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
228
229 TP_ARGS(clnt, task, action),
230
231 TP_FIELDS(
232 ctf_integer(unsigned int, task_id, task->tk_pid)
233 ctf_integer(int, client_id, lttng_get_clid(task))
234 ctf_integer_hex(const void *, action, action)
235 ctf_integer(unsigned long, runstate, task->tk_runstate)
236 ctf_integer(int, status, task->tk_status)
237 ctf_integer(unsigned short, flags, task->tk_flags)
238 )
239 )
240
241 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin,
242
243 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
244
245 TP_ARGS(clnt, task, action)
246 )
247
248 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action,
249
250 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
251
252 TP_ARGS(clnt, task, action)
253 )
254
255 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete,
256
257 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
258
259 TP_ARGS(clnt, task, action)
260 )
261
262 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued,
263
264 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
265
266 TP_ARGS(clnt, task, q),
267
268 TP_FIELDS(
269 ctf_integer(unsigned int, task_id, task->tk_pid)
270 ctf_integer(int, client_id, lttng_get_clid(task))
271 ctf_integer(unsigned long, timeout, task->tk_timeout)
272 ctf_integer(unsigned long, runstate, task->tk_runstate)
273 ctf_integer(int, status, task->tk_status)
274 ctf_integer(unsigned short, flags, task->tk_flags)
275 ctf_string(q_name, rpc_qname(q))
276 )
277 )
278
279 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep,
280
281 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
282
283 TP_ARGS(clnt, task, q)
284 )
285
286 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup,
287
288 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
289
290 TP_ARGS(clnt, task, q)
291 )
292
293 #else
294 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
295
296 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
297
298 TP_ARGS(clnt, task, action),
299
300 TP_FIELDS(
301 ctf_integer_hex(const struct rpc_clnt *, clnt, clnt)
302 ctf_integer_hex(const struct rpc_task *, task, task)
303 ctf_integer_hex(const void *, action, action)
304 ctf_integer(unsigned long, runstate, task->tk_runstate)
305 ctf_integer(int, status, task->tk_status)
306 ctf_integer(unsigned short, flags, task->tk_flags)
307 )
308 )
309
310 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin,
311
312 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
313
314 TP_ARGS(clnt, task, action)
315 )
316
317 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action,
318
319 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
320
321 TP_ARGS(clnt, task, action)
322 )
323
324 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete,
325
326 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
327
328 TP_ARGS(clnt, task, action)
329 )
330
331 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued,
332
333 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
334
335 TP_ARGS(clnt, task, q),
336
337 TP_FIELDS(
338 ctf_integer_hex(const struct rpc_clnt *, clnt, clnt)
339 ctf_integer_hex(const struct rpc_task *, task, task)
340 ctf_integer(unsigned long, timeout, task->tk_timeout)
341 ctf_integer(unsigned long, runstate, task->tk_runstate)
342 ctf_integer(int, status, task->tk_status)
343 ctf_integer(unsigned short, flags, task->tk_flags)
344 ctf_string(q_name, rpc_qname(q))
345 )
346 )
347
348 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep,
349
350 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
351
352 TP_ARGS(clnt, task, q)
353 )
354
355 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup,
356
357 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
358
359 TP_ARGS(clnt, task, q)
360 )
361 #endif
362
363 #endif /* LTTNG_TRACE_RPC_H */
364
365 #include <probes/define_trace.h>
This page took 0.061153 seconds and 4 git commands to generate.