Move headers under include/
[lttng-modules.git] / include / instrumentation / events / lttng-module / rpc.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM rpc
4
5 #if !defined(LTTNG_TRACE_RPC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_RPC_H
7
8 #include <lttng/lttng-tracepoint-event.h>
9 #include <linux/sunrpc/sched.h>
10 #include <linux/sunrpc/clnt.h>
11
12 #ifndef ONCE_LTTNG_RPC_H
13 #define ONCE_LTTNG_RPC_H
14
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
31 #endif /* ONCE_LTTNG_RPC_H */
32
33 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_status,
34
35 TP_PROTO(const struct rpc_task *task),
36
37 TP_ARGS(task),
38
39 TP_FIELDS(
40 ctf_integer(unsigned int, task_id, task->tk_pid)
41 ctf_integer(int, client_id, lttng_get_clid(task))
42 ctf_integer(int, status, task->tk_status)
43 )
44 )
45
46 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_call_status,
47 TP_PROTO(const struct rpc_task *task),
48
49 TP_ARGS(task)
50 )
51
52 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_bind_status,
53 TP_PROTO(const struct rpc_task *task),
54
55 TP_ARGS(task)
56 )
57
58 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_status, rpc_connect_status,
59 TP_PROTO(const struct rpc_task *task),
60
61 TP_ARGS(task)
62 )
63
64 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_running,
65
66 TP_PROTO(const struct rpc_task *task, const void *action),
67
68 TP_ARGS(task, action),
69
70 TP_FIELDS(
71 ctf_integer(unsigned int, task_id, task->tk_pid)
72 ctf_integer(int, client_id, lttng_get_clid(task))
73 ctf_integer_hex(const void *, action, action)
74 ctf_integer(unsigned long, runstate, task->tk_runstate)
75 ctf_integer(int, status, task->tk_status)
76 ctf_integer(unsigned short, flags, task->tk_flags)
77 )
78 )
79
80 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_begin,
81
82 TP_PROTO(const struct rpc_task *task, const void *action),
83
84 TP_ARGS(task, action)
85 )
86
87 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_run_action,
88
89 TP_PROTO(const struct rpc_task *task, const void *action),
90
91 TP_ARGS(task, action)
92 )
93
94 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_running, rpc_task_complete,
95
96 TP_PROTO(const struct rpc_task *task, const void *action),
97
98 TP_ARGS(task, action)
99 )
100
101 LTTNG_TRACEPOINT_EVENT_CLASS(rpc_task_queued,
102
103 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
104
105 TP_ARGS(task, q),
106
107 TP_FIELDS(
108 ctf_integer(unsigned int, task_id, task->tk_pid)
109 ctf_integer(int, client_id, lttng_get_clid(task))
110 ctf_integer(unsigned long, timeout, task->tk_timeout)
111 ctf_integer(unsigned long, runstate, task->tk_runstate)
112 ctf_integer(int, status, task->tk_status)
113 ctf_integer(unsigned short, flags, task->tk_flags)
114 ctf_string(q_name, rpc_qname(q))
115 )
116 )
117
118 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_sleep,
119
120 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
121
122 TP_ARGS(task, q)
123 )
124
125 LTTNG_TRACEPOINT_EVENT_INSTANCE(rpc_task_queued, rpc_task_wakeup,
126
127 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
128
129 TP_ARGS(task, q)
130 )
131
132 #endif /* LTTNG_TRACE_RPC_H */
133
134 #include <lttng/define_trace.h>
This page took 0.0314 seconds and 4 git commands to generate.