Migrate tracepoint instrumentation to TP_FIELDS
[lttng-modules.git] / instrumentation / events / lttng-module / timer.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM timer
3
4 #if !defined(LTTNG_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_TIMER_H
6
7 #include "../../../probes/lttng-tracepoint-event.h"
8
9 #ifndef _TRACE_TIMER_DEF_
10 #define _TRACE_TIMER_DEF_
11 #include <linux/hrtimer.h>
12 #include <linux/timer.h>
13
14 struct timer_list;
15
16 #endif /* _TRACE_TIMER_DEF_ */
17
18 LTTNG_TRACEPOINT_EVENT_CLASS(timer_class,
19
20 TP_PROTO(struct timer_list *timer),
21
22 TP_ARGS(timer),
23
24 TP_FIELDS(
25 ctf_integer(void *, timer, timer)
26 )
27 )
28
29 /**
30 * timer_init - called when the timer is initialized
31 * @timer: pointer to struct timer_list
32 */
33 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class, timer_init,
34
35 TP_PROTO(struct timer_list *timer),
36
37 TP_ARGS(timer)
38 )
39
40 /**
41 * timer_start - called when the timer is started
42 * @timer: pointer to struct timer_list
43 * @expires: the timers expiry time
44 */
45 LTTNG_TRACEPOINT_EVENT(timer_start,
46
47 TP_PROTO(struct timer_list *timer, unsigned long expires),
48
49 TP_ARGS(timer, expires),
50
51 TP_FIELDS(
52 ctf_integer(void *, timer, timer)
53 ctf_integer(void *, function, timer->function)
54 ctf_integer(unsigned long, expires, expires)
55 ctf_integer(unsigned long, now, jiffies)
56 )
57 )
58
59 /**
60 * timer_expire_entry - called immediately before the timer callback
61 * @timer: pointer to struct timer_list
62 *
63 * Allows to determine the timer latency.
64 */
65 LTTNG_TRACEPOINT_EVENT(timer_expire_entry,
66
67 TP_PROTO(struct timer_list *timer),
68
69 TP_ARGS(timer),
70
71 TP_FIELDS(
72 ctf_integer(void *, timer, timer)
73 ctf_integer(unsigned long, now, jiffies)
74 ctf_integer(void *, function, timer->function)
75 )
76 )
77
78 /**
79 * timer_expire_exit - called immediately after the timer callback returns
80 * @timer: pointer to struct timer_list
81 *
82 * When used in combination with the timer_expire_entry tracepoint we can
83 * determine the runtime of the timer callback function.
84 *
85 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
86 * be invalid. We solely track the pointer.
87 */
88 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class, timer_expire_exit,
89
90 TP_PROTO(struct timer_list *timer),
91
92 TP_ARGS(timer)
93 )
94
95 /**
96 * timer_cancel - called when the timer is canceled
97 * @timer: pointer to struct timer_list
98 */
99 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class, timer_cancel,
100
101 TP_PROTO(struct timer_list *timer),
102
103 TP_ARGS(timer)
104 )
105
106 /**
107 * hrtimer_init - called when the hrtimer is initialized
108 * @timer: pointer to struct hrtimer
109 * @clockid: the hrtimers clock
110 * @mode: the hrtimers mode
111 */
112 LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_init,
113
114 timer_hrtimer_init,
115
116 TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
117 enum hrtimer_mode mode),
118
119 TP_ARGS(hrtimer, clockid, mode),
120
121 TP_FIELDS(
122 ctf_integer(void *, hrtimer, hrtimer)
123 ctf_integer(clockid_t, clockid, clockid)
124 ctf_integer(enum hrtimer_mode, mode, mode)
125 )
126 )
127
128 /**
129 * hrtimer_start - called when the hrtimer is started
130 * @timer: pointer to struct hrtimer
131 */
132 LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_start,
133
134 timer_hrtimer_start,
135
136 TP_PROTO(struct hrtimer *hrtimer),
137
138 TP_ARGS(hrtimer),
139
140 TP_FIELDS(
141 ctf_integer(void *, hrtimer, hrtimer)
142 ctf_integer(void *, function, hrtimer->function)
143 ctf_integer(s64, expires, hrtimer_get_expires(hrtimer).tv64)
144 ctf_integer(s64, softexpires, hrtimer_get_softexpires(hrtimer).tv64)
145 )
146 )
147
148 /**
149 * htimmer_expire_entry - called immediately before the hrtimer callback
150 * @timer: pointer to struct hrtimer
151 * @now: pointer to variable which contains current time of the
152 * timers base.
153 *
154 * Allows to determine the timer latency.
155 */
156 LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_expire_entry,
157
158 timer_hrtimer_expire_entry,
159
160 TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
161
162 TP_ARGS(hrtimer, now),
163
164 TP_FIELDS(
165 ctf_integer(void *, hrtimer, hrtimer)
166 ctf_integer(s64, now, now->tv64)
167 ctf_integer(void *, function, hrtimer->function)
168 )
169 )
170
171 LTTNG_TRACEPOINT_EVENT_CLASS(timer_hrtimer_class,
172
173 TP_PROTO(struct hrtimer *hrtimer),
174
175 TP_ARGS(hrtimer),
176
177 TP_FIELDS(
178 ctf_integer(void *, hrtimer, hrtimer)
179 )
180 )
181
182 /**
183 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
184 * @timer: pointer to struct hrtimer
185 *
186 * When used in combination with the hrtimer_expire_entry tracepoint we can
187 * determine the runtime of the callback function.
188 */
189 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class, hrtimer_expire_exit,
190
191 timer_hrtimer_expire_exit,
192
193 TP_PROTO(struct hrtimer *hrtimer),
194
195 TP_ARGS(hrtimer)
196 )
197
198 /**
199 * hrtimer_cancel - called when the hrtimer is canceled
200 * @hrtimer: pointer to struct hrtimer
201 */
202 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class, hrtimer_cancel,
203
204 timer_hrtimer_cancel,
205
206 TP_PROTO(struct hrtimer *hrtimer),
207
208 TP_ARGS(hrtimer)
209 )
210
211 /**
212 * itimer_state - called when itimer is started or canceled
213 * @which: name of the interval timer
214 * @value: the itimers value, itimer is canceled if value->it_value is
215 * zero, otherwise it is started
216 * @expires: the itimers expiry time
217 */
218 LTTNG_TRACEPOINT_EVENT_MAP(itimer_state,
219
220 timer_itimer_state,
221
222 TP_PROTO(int which, const struct itimerval *const value,
223 cputime_t expires),
224
225 TP_ARGS(which, value, expires),
226
227 TP_FIELDS(
228 ctf_integer(int, which, which)
229 ctf_integer(cputime_t, expires, expires)
230 ctf_integer(long, value_sec, value->it_value.tv_sec)
231 ctf_integer(long, value_usec, value->it_value.tv_usec)
232 ctf_integer(long, interval_sec, value->it_interval.tv_sec)
233 ctf_integer(long, interval_usec, value->it_interval.tv_usec)
234 )
235 )
236
237 /**
238 * itimer_expire - called when itimer expires
239 * @which: type of the interval timer
240 * @pid: pid of the process which owns the timer
241 * @now: current time, used to calculate the latency of itimer
242 */
243 LTTNG_TRACEPOINT_EVENT_MAP(itimer_expire,
244
245 timer_itimer_expire,
246
247 TP_PROTO(int which, struct pid *pid, cputime_t now),
248
249 TP_ARGS(which, pid, now),
250
251 TP_FIELDS(
252 ctf_integer(int , which, which)
253 ctf_integer(pid_t, pid, pid_nr(pid))
254 ctf_integer(cputime_t, now, now)
255 )
256 )
257
258 #endif /* LTTNG_TRACE_TIMER_H */
259
260 /* This part must be outside protection */
261 #include "../../../probes/define_trace.h"
This page took 0.035714 seconds and 4 git commands to generate.