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