2 #define TRACE_SYSTEM timer
4 #if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/tracepoint.h>
9 #ifndef _TRACE_TIMER_DEF_
10 #define _TRACE_TIMER_DEF_
11 #include <linux/hrtimer.h>
12 #include <linux/timer.h>
13 #endif /* _TRACE_TIMER_DEF_ */
15 DECLARE_EVENT_CLASS(timer_class
,
17 TP_PROTO(struct timer_list
*timer
),
22 __field( void *, timer
)
26 tp_assign(timer
, timer
)
29 TP_printk("timer=%p", __entry
->timer
)
33 * timer_init - called when the timer is initialized
34 * @timer: pointer to struct timer_list
36 DEFINE_EVENT(timer_class
, timer_init
,
38 TP_PROTO(struct timer_list
*timer
),
44 * timer_start - called when the timer is started
45 * @timer: pointer to struct timer_list
46 * @expires: the timers expiry time
48 TRACE_EVENT(timer_start
,
50 TP_PROTO(struct timer_list
*timer
, unsigned long expires
),
52 TP_ARGS(timer
, expires
),
55 __field( void *, timer
)
56 __field( void *, function
)
57 __field( unsigned long, expires
)
58 __field( unsigned long, now
)
62 tp_assign(timer
, timer
)
63 tp_assign(function
, timer
->function
)
64 tp_assign(expires
, expires
)
65 tp_assign(now
, jiffies
)
68 TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
69 __entry
->timer
, __entry
->function
, __entry
->expires
,
70 (long)__entry
->expires
- __entry
->now
)
74 * timer_expire_entry - called immediately before the timer callback
75 * @timer: pointer to struct timer_list
77 * Allows to determine the timer latency.
79 TRACE_EVENT(timer_expire_entry
,
81 TP_PROTO(struct timer_list
*timer
),
86 __field( void *, timer
)
87 __field( unsigned long, now
)
88 __field( void *, function
)
92 tp_assign(timer
, timer
)
93 tp_assign(now
, jiffies
)
94 tp_assign(function
, timer
->function
)
97 TP_printk("timer=%p function=%pf now=%lu", __entry
->timer
, __entry
->function
,__entry
->now
)
101 * timer_expire_exit - called immediately after the timer callback returns
102 * @timer: pointer to struct timer_list
104 * When used in combination with the timer_expire_entry tracepoint we can
105 * determine the runtime of the timer callback function.
107 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
108 * be invalid. We solely track the pointer.
110 DEFINE_EVENT(timer_class
, timer_expire_exit
,
112 TP_PROTO(struct timer_list
*timer
),
118 * timer_cancel - called when the timer is canceled
119 * @timer: pointer to struct timer_list
121 DEFINE_EVENT(timer_class
, timer_cancel
,
123 TP_PROTO(struct timer_list
*timer
),
129 * hrtimer_init - called when the hrtimer is initialized
130 * @timer: pointer to struct hrtimer
131 * @clockid: the hrtimers clock
132 * @mode: the hrtimers mode
134 TRACE_EVENT(hrtimer_init
,
136 TP_PROTO(struct hrtimer
*hrtimer
, clockid_t clockid
,
137 enum hrtimer_mode mode
),
139 TP_ARGS(hrtimer
, clockid
, mode
),
142 __field( void *, hrtimer
)
143 __field( clockid_t
, clockid
)
144 __field( enum hrtimer_mode
, mode
)
148 tp_assign(hrtimer
, hrtimer
)
149 tp_assign(clockid
, clockid
)
150 tp_assign(mode
, mode
)
153 TP_printk("hrtimer=%p clockid=%s mode=%s", __entry
->hrtimer
,
154 __entry
->clockid
== CLOCK_REALTIME
?
155 "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
156 __entry
->mode
== HRTIMER_MODE_ABS
?
157 "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
161 * hrtimer_start - called when the hrtimer is started
162 * @timer: pointer to struct hrtimer
164 TRACE_EVENT(hrtimer_start
,
166 TP_PROTO(struct hrtimer
*hrtimer
),
171 __field( void *, hrtimer
)
172 __field( void *, function
)
173 __field( s64
, expires
)
174 __field( s64
, softexpires
)
178 tp_assign(hrtimer
, hrtimer
)
179 tp_assign(function
, hrtimer
->function
)
180 tp_assign(expires
, hrtimer_get_expires(hrtimer
).tv64
)
181 tp_assign(softexpires
, hrtimer_get_softexpires(hrtimer
).tv64
)
184 TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
185 __entry
->hrtimer
, __entry
->function
,
186 (unsigned long long)ktime_to_ns((ktime_t
) {
187 .tv64
= __entry
->expires
}),
188 (unsigned long long)ktime_to_ns((ktime_t
) {
189 .tv64
= __entry
->softexpires
}))
193 * htimmer_expire_entry - called immediately before the hrtimer callback
194 * @timer: pointer to struct hrtimer
195 * @now: pointer to variable which contains current time of the
198 * Allows to determine the timer latency.
200 TRACE_EVENT(hrtimer_expire_entry
,
202 TP_PROTO(struct hrtimer
*hrtimer
, ktime_t
*now
),
204 TP_ARGS(hrtimer
, now
),
207 __field( void *, hrtimer
)
209 __field( void *, function
)
213 tp_assign(hrtimer
, hrtimer
)
214 tp_assign(now
, now
->tv64
)
215 tp_assign(function
, hrtimer
->function
)
218 TP_printk("hrtimer=%p function=%pf now=%llu", __entry
->hrtimer
, __entry
->function
,
219 (unsigned long long)ktime_to_ns((ktime_t
) { .tv64
= __entry
->now
}))
222 DECLARE_EVENT_CLASS(hrtimer_class
,
224 TP_PROTO(struct hrtimer
*hrtimer
),
229 __field( void *, hrtimer
)
233 tp_assign(hrtimer
, hrtimer
)
236 TP_printk("hrtimer=%p", __entry
->hrtimer
)
240 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
241 * @timer: pointer to struct hrtimer
243 * When used in combination with the hrtimer_expire_entry tracepoint we can
244 * determine the runtime of the callback function.
246 DEFINE_EVENT(hrtimer_class
, hrtimer_expire_exit
,
248 TP_PROTO(struct hrtimer
*hrtimer
),
254 * hrtimer_cancel - called when the hrtimer is canceled
255 * @hrtimer: pointer to struct hrtimer
257 DEFINE_EVENT(hrtimer_class
, hrtimer_cancel
,
259 TP_PROTO(struct hrtimer
*hrtimer
),
265 * itimer_state - called when itimer is started or canceled
266 * @which: name of the interval timer
267 * @value: the itimers value, itimer is canceled if value->it_value is
268 * zero, otherwise it is started
269 * @expires: the itimers expiry time
271 TRACE_EVENT(itimer_state
,
273 TP_PROTO(int which
, const struct itimerval
*const value
,
276 TP_ARGS(which
, value
, expires
),
279 __field( int, which
)
280 __field( cputime_t
, expires
)
281 __field( long, value_sec
)
282 __field( long, value_usec
)
283 __field( long, interval_sec
)
284 __field( long, interval_usec
)
288 tp_assign(which
, which
)
289 tp_assign(expires
, expires
)
290 tp_assign(value_sec
, value
->it_value
.tv_sec
)
291 tp_assign(value_usec
, value
->it_value
.tv_usec
)
292 tp_assign(interval_sec
, value
->it_interval
.tv_sec
)
293 tp_assign(interval_usec
, value
->it_interval
.tv_usec
)
296 TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
297 __entry
->which
, (unsigned long long)__entry
->expires
,
298 __entry
->value_sec
, __entry
->value_usec
,
299 __entry
->interval_sec
, __entry
->interval_usec
)
303 * itimer_expire - called when itimer expires
304 * @which: type of the interval timer
305 * @pid: pid of the process which owns the timer
306 * @now: current time, used to calculate the latency of itimer
308 TRACE_EVENT(itimer_expire
,
310 TP_PROTO(int which
, struct pid
*pid
, cputime_t now
),
312 TP_ARGS(which
, pid
, now
),
315 __field( int , which
)
316 __field( pid_t
, pid
)
317 __field( cputime_t
, now
)
321 tp_assign(which
, which
)
323 tp_assign(pid
, pid_nr(pid
))
326 TP_printk("which=%d pid=%d now=%llu", __entry
->which
,
327 (int) __entry
->pid
, (unsigned long long)__entry
->now
)
330 #endif /* _TRACE_TIMER_H */
332 /* This part must be outside protection */
333 #include "../../../probes/define_trace.h"
This page took 0.039971 seconds and 5 git commands to generate.