2 #define TRACE_SYSTEM timer
4 #if !defined(LTTNG_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_TIMER_H
7 #include "../../../probes/lttng-tracepoint-event.h"
9 #ifndef _TRACE_TIMER_DEF_
10 #define _TRACE_TIMER_DEF_
11 #include <linux/hrtimer.h>
12 #include <linux/timer.h>
16 #endif /* _TRACE_TIMER_DEF_ */
18 LTTNG_TRACEPOINT_EVENT_CLASS(timer_class
,
20 TP_PROTO(struct timer_list
*timer
),
25 ctf_integer(void *, timer
, timer
)
30 * timer_init - called when the timer is initialized
31 * @timer: pointer to struct timer_list
33 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class
, timer_init
,
35 TP_PROTO(struct timer_list
*timer
),
41 * timer_start - called when the timer is started
42 * @timer: pointer to struct timer_list
43 * @expires: the timers expiry time
45 LTTNG_TRACEPOINT_EVENT(timer_start
,
47 TP_PROTO(struct timer_list
*timer
, unsigned long expires
),
49 TP_ARGS(timer
, expires
),
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
)
60 * timer_expire_entry - called immediately before the timer callback
61 * @timer: pointer to struct timer_list
63 * Allows to determine the timer latency.
65 LTTNG_TRACEPOINT_EVENT(timer_expire_entry
,
67 TP_PROTO(struct timer_list
*timer
),
72 ctf_integer(void *, timer
, timer
)
73 ctf_integer(unsigned long, now
, jiffies
)
74 ctf_integer(void *, function
, timer
->function
)
79 * timer_expire_exit - called immediately after the timer callback returns
80 * @timer: pointer to struct timer_list
82 * When used in combination with the timer_expire_entry tracepoint we can
83 * determine the runtime of the timer callback function.
85 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
86 * be invalid. We solely track the pointer.
88 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class
, timer_expire_exit
,
90 TP_PROTO(struct timer_list
*timer
),
96 * timer_cancel - called when the timer is canceled
97 * @timer: pointer to struct timer_list
99 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class
, timer_cancel
,
101 TP_PROTO(struct timer_list
*timer
),
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
112 LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_init
,
116 TP_PROTO(struct hrtimer
*hrtimer
, clockid_t clockid
,
117 enum hrtimer_mode mode
),
119 TP_ARGS(hrtimer
, clockid
, mode
),
122 ctf_integer(void *, hrtimer
, hrtimer
)
123 ctf_integer(clockid_t
, clockid
, clockid
)
124 ctf_integer(enum hrtimer_mode
, mode
, mode
)
129 * hrtimer_start - called when the hrtimer is started
130 * @timer: pointer to struct hrtimer
132 LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_start
,
136 TP_PROTO(struct hrtimer
*hrtimer
),
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
)
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
154 * Allows to determine the timer latency.
156 LTTNG_TRACEPOINT_EVENT_MAP(hrtimer_expire_entry
,
158 timer_hrtimer_expire_entry
,
160 TP_PROTO(struct hrtimer
*hrtimer
, ktime_t
*now
),
162 TP_ARGS(hrtimer
, now
),
165 ctf_integer(void *, hrtimer
, hrtimer
)
166 ctf_integer(s64
, now
, now
->tv64
)
167 ctf_integer(void *, function
, hrtimer
->function
)
171 LTTNG_TRACEPOINT_EVENT_CLASS(timer_hrtimer_class
,
173 TP_PROTO(struct hrtimer
*hrtimer
),
178 ctf_integer(void *, hrtimer
, hrtimer
)
183 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
184 * @timer: pointer to struct hrtimer
186 * When used in combination with the hrtimer_expire_entry tracepoint we can
187 * determine the runtime of the callback function.
189 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class
, hrtimer_expire_exit
,
191 timer_hrtimer_expire_exit
,
193 TP_PROTO(struct hrtimer
*hrtimer
),
199 * hrtimer_cancel - called when the hrtimer is canceled
200 * @hrtimer: pointer to struct hrtimer
202 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(timer_hrtimer_class
, hrtimer_cancel
,
204 timer_hrtimer_cancel
,
206 TP_PROTO(struct hrtimer
*hrtimer
),
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
218 LTTNG_TRACEPOINT_EVENT_MAP(itimer_state
,
222 TP_PROTO(int which
, const struct itimerval
*const value
,
225 TP_ARGS(which
, value
, expires
),
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
)
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
243 LTTNG_TRACEPOINT_EVENT_MAP(itimer_expire
,
247 TP_PROTO(int which
, struct pid
*pid
, cputime_t now
),
249 TP_ARGS(which
, pid
, now
),
252 ctf_integer(int , which
, which
)
253 ctf_integer(pid_t
, pid
, pid_nr(pid
))
254 ctf_integer(cputime_t
, now
, now
)
258 #endif /* LTTNG_TRACE_TIMER_H */
260 /* This part must be outside protection */
261 #include "../../../probes/define_trace.h"