Commit | Line | Data |
---|---|---|
e54456f5 MD |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM timer | |
3 | ||
3bc29f0a MD |
4 | #if !defined(LTTNG_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ) |
5 | #define LTTNG_TRACE_TIMER_H | |
e54456f5 | 6 | |
3bc29f0a | 7 | #include "../../../probes/lttng-tracepoint-event.h" |
e54456f5 MD |
8 | |
9 | #ifndef _TRACE_TIMER_DEF_ | |
10 | #define _TRACE_TIMER_DEF_ | |
11 | #include <linux/hrtimer.h> | |
12 | #include <linux/timer.h> | |
3a523f5b MD |
13 | |
14 | struct timer_list; | |
15 | ||
e54456f5 MD |
16 | #endif /* _TRACE_TIMER_DEF_ */ |
17 | ||
3bc29f0a | 18 | LTTNG_TRACEPOINT_EVENT_CLASS(timer_class, |
e54456f5 MD |
19 | |
20 | TP_PROTO(struct timer_list *timer), | |
21 | ||
22 | TP_ARGS(timer), | |
23 | ||
f127e61e MD |
24 | TP_FIELDS( |
25 | ctf_integer(void *, timer, timer) | |
26 | ) | |
e54456f5 MD |
27 | ) |
28 | ||
29 | /** | |
30 | * timer_init - called when the timer is initialized | |
31 | * @timer: pointer to struct timer_list | |
32 | */ | |
3bc29f0a | 33 | LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class, timer_init, |
e54456f5 MD |
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 | */ | |
3bc29f0a | 45 | LTTNG_TRACEPOINT_EVENT(timer_start, |
e54456f5 MD |
46 | |
47 | TP_PROTO(struct timer_list *timer, unsigned long expires), | |
48 | ||
49 | TP_ARGS(timer, expires), | |
50 | ||
f127e61e MD |
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 | ) | |
e54456f5 MD |
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 | */ | |
3bc29f0a | 65 | LTTNG_TRACEPOINT_EVENT(timer_expire_entry, |
e54456f5 MD |
66 | |
67 | TP_PROTO(struct timer_list *timer), | |
68 | ||
69 | TP_ARGS(timer), | |
70 | ||
f127e61e MD |
71 | TP_FIELDS( |
72 | ctf_integer(void *, timer, timer) | |
73 | ctf_integer(unsigned long, now, jiffies) | |
74 | ctf_integer(void *, function, timer->function) | |
75 | ) | |
e54456f5 MD |
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 | */ | |
3bc29f0a | 88 | LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class, timer_expire_exit, |
e54456f5 MD |
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 | */ | |
3bc29f0a | 99 | LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class, timer_cancel, |
e54456f5 MD |
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 | */ | |
9bbf98da MD |
112 | LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_init, |
113 | ||
114 | timer_hrtimer_init, | |
e54456f5 MD |
115 | |
116 | TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid, | |
117 | enum hrtimer_mode mode), | |
118 | ||
119 | TP_ARGS(hrtimer, clockid, mode), | |
120 | ||
f127e61e MD |
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 | ) | |
e54456f5 MD |
126 | ) |
127 | ||
128 | /** | |
129 | * hrtimer_start - called when the hrtimer is started | |
130 | * @timer: pointer to struct hrtimer | |
131 | */ | |
9bbf98da MD |
132 | LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_start, |
133 | ||
134 | timer_hrtimer_start, | |
e54456f5 MD |
135 | |
136 | TP_PROTO(struct hrtimer *hrtimer), | |
137 | ||
138 | TP_ARGS(hrtimer), | |
139 | ||
f127e61e MD |
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 | ) | |
e54456f5 MD |
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 | */ | |
9bbf98da MD |
156 | LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_expire_entry, |
157 | ||
158 | timer_hrtimer_expire_entry, | |
e54456f5 MD |
159 | |
160 | TP_PROTO(struct hrtimer *hrtimer, ktime_t *now), | |
161 | ||
162 | TP_ARGS(hrtimer, now), | |
163 | ||
f127e61e MD |
164 | TP_FIELDS( |
165 | ctf_integer(void *, hrtimer, hrtimer) | |
166 | ctf_integer(s64, now, now->tv64) | |
167 | ctf_integer(void *, function, hrtimer->function) | |
168 | ) | |
e54456f5 MD |
169 | ) |
170 | ||
9bbf98da | 171 | LTTNG_TRACEPOINT_EVENT_CLASS(timer_hrtimer_class, |
e54456f5 MD |
172 | |
173 | TP_PROTO(struct hrtimer *hrtimer), | |
174 | ||
175 | TP_ARGS(hrtimer), | |
176 | ||
f127e61e MD |
177 | TP_FIELDS( |
178 | ctf_integer(void *, hrtimer, hrtimer) | |
179 | ) | |
e54456f5 MD |
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 | */ | |
9bbf98da MD |
189 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class, hrtimer_expire_exit, |
190 | ||
191 | timer_hrtimer_expire_exit, | |
e54456f5 MD |
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 | */ | |
9bbf98da MD |
202 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class, hrtimer_cancel, |
203 | ||
204 | timer_hrtimer_cancel, | |
e54456f5 MD |
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 | */ | |
9bbf98da MD |
218 | LTTNG_TRACEPOINT_EVENT_MAP(itimer_state, |
219 | ||
220 | timer_itimer_state, | |
e54456f5 MD |
221 | |
222 | TP_PROTO(int which, const struct itimerval *const value, | |
223 | cputime_t expires), | |
224 | ||
225 | TP_ARGS(which, value, expires), | |
226 | ||
f127e61e MD |
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 | ) | |
e54456f5 MD |
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 | */ | |
9bbf98da MD |
243 | LTTNG_TRACEPOINT_EVENT_MAP(itimer_expire, |
244 | ||
245 | timer_itimer_expire, | |
e54456f5 MD |
246 | |
247 | TP_PROTO(int which, struct pid *pid, cputime_t now), | |
248 | ||
249 | TP_ARGS(which, pid, now), | |
250 | ||
f127e61e MD |
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 | ) | |
e54456f5 MD |
256 | ) |
257 | ||
3bc29f0a | 258 | #endif /* LTTNG_TRACE_TIMER_H */ |
e54456f5 MD |
259 | |
260 | /* This part must be outside protection */ | |
261 | #include "../../../probes/define_trace.h" |