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 __field( void *, timer
)
29 tp_assign(timer
, timer
)
32 TP_printk("timer=%p", __entry
->timer
)
36 * timer_init - called when the timer is initialized
37 * @timer: pointer to struct timer_list
39 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class
, timer_init
,
41 TP_PROTO(struct timer_list
*timer
),
47 * timer_start - called when the timer is started
48 * @timer: pointer to struct timer_list
49 * @expires: the timers expiry time
51 LTTNG_TRACEPOINT_EVENT(timer_start
,
53 TP_PROTO(struct timer_list
*timer
, unsigned long expires
),
55 TP_ARGS(timer
, expires
),
58 __field( void *, timer
)
59 __field( void *, function
)
60 __field( unsigned long, expires
)
61 __field( unsigned long, now
)
65 tp_assign(timer
, timer
)
66 tp_assign(function
, timer
->function
)
67 tp_assign(expires
, expires
)
68 tp_assign(now
, jiffies
)
71 TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
72 __entry
->timer
, __entry
->function
, __entry
->expires
,
73 (long)__entry
->expires
- __entry
->now
)
77 * timer_expire_entry - called immediately before the timer callback
78 * @timer: pointer to struct timer_list
80 * Allows to determine the timer latency.
82 LTTNG_TRACEPOINT_EVENT(timer_expire_entry
,
84 TP_PROTO(struct timer_list
*timer
),
89 __field( void *, timer
)
90 __field( unsigned long, now
)
91 __field( void *, function
)
95 tp_assign(timer
, timer
)
96 tp_assign(now
, jiffies
)
97 tp_assign(function
, timer
->function
)
100 TP_printk("timer=%p function=%pf now=%lu", __entry
->timer
, __entry
->function
,__entry
->now
)
104 * timer_expire_exit - called immediately after the timer callback returns
105 * @timer: pointer to struct timer_list
107 * When used in combination with the timer_expire_entry tracepoint we can
108 * determine the runtime of the timer callback function.
110 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
111 * be invalid. We solely track the pointer.
113 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class
, timer_expire_exit
,
115 TP_PROTO(struct timer_list
*timer
),
121 * timer_cancel - called when the timer is canceled
122 * @timer: pointer to struct timer_list
124 LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class
, timer_cancel
,
126 TP_PROTO(struct timer_list
*timer
),
132 * hrtimer_init - called when the hrtimer is initialized
133 * @timer: pointer to struct hrtimer
134 * @clockid: the hrtimers clock
135 * @mode: the hrtimers mode
137 LTTNG_TRACEPOINT_EVENT(hrtimer_init
,
139 TP_PROTO(struct hrtimer
*hrtimer
, clockid_t clockid
,
140 enum hrtimer_mode mode
),
142 TP_ARGS(hrtimer
, clockid
, mode
),
145 __field( void *, hrtimer
)
146 __field( clockid_t
, clockid
)
147 __field( enum hrtimer_mode
, mode
)
151 tp_assign(hrtimer
, hrtimer
)
152 tp_assign(clockid
, clockid
)
153 tp_assign(mode
, mode
)
156 TP_printk("hrtimer=%p clockid=%s mode=%s", __entry
->hrtimer
,
157 __entry
->clockid
== CLOCK_REALTIME
?
158 "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
159 __entry
->mode
== HRTIMER_MODE_ABS
?
160 "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
164 * hrtimer_start - called when the hrtimer is started
165 * @timer: pointer to struct hrtimer
167 LTTNG_TRACEPOINT_EVENT(hrtimer_start
,
169 TP_PROTO(struct hrtimer
*hrtimer
),
174 __field( void *, hrtimer
)
175 __field( void *, function
)
176 __field( s64
, expires
)
177 __field( s64
, softexpires
)
181 tp_assign(hrtimer
, hrtimer
)
182 tp_assign(function
, hrtimer
->function
)
183 tp_assign(expires
, hrtimer_get_expires(hrtimer
).tv64
)
184 tp_assign(softexpires
, hrtimer_get_softexpires(hrtimer
).tv64
)
187 TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
188 __entry
->hrtimer
, __entry
->function
,
189 (unsigned long long)ktime_to_ns((ktime_t
) {
190 .tv64
= __entry
->expires
}),
191 (unsigned long long)ktime_to_ns((ktime_t
) {
192 .tv64
= __entry
->softexpires
}))
196 * htimmer_expire_entry - called immediately before the hrtimer callback
197 * @timer: pointer to struct hrtimer
198 * @now: pointer to variable which contains current time of the
201 * Allows to determine the timer latency.
203 LTTNG_TRACEPOINT_EVENT(hrtimer_expire_entry
,
205 TP_PROTO(struct hrtimer
*hrtimer
, ktime_t
*now
),
207 TP_ARGS(hrtimer
, now
),
210 __field( void *, hrtimer
)
212 __field( void *, function
)
216 tp_assign(hrtimer
, hrtimer
)
217 tp_assign(now
, now
->tv64
)
218 tp_assign(function
, hrtimer
->function
)
221 TP_printk("hrtimer=%p function=%pf now=%llu", __entry
->hrtimer
, __entry
->function
,
222 (unsigned long long)ktime_to_ns((ktime_t
) { .tv64
= __entry
->now
}))
225 LTTNG_TRACEPOINT_EVENT_CLASS(hrtimer_class
,
227 TP_PROTO(struct hrtimer
*hrtimer
),
232 __field( void *, hrtimer
)
236 tp_assign(hrtimer
, hrtimer
)
239 TP_printk("hrtimer=%p", __entry
->hrtimer
)
243 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
244 * @timer: pointer to struct hrtimer
246 * When used in combination with the hrtimer_expire_entry tracepoint we can
247 * determine the runtime of the callback function.
249 LTTNG_TRACEPOINT_EVENT_INSTANCE(hrtimer_class
, hrtimer_expire_exit
,
251 TP_PROTO(struct hrtimer
*hrtimer
),
257 * hrtimer_cancel - called when the hrtimer is canceled
258 * @hrtimer: pointer to struct hrtimer
260 LTTNG_TRACEPOINT_EVENT_INSTANCE(hrtimer_class
, hrtimer_cancel
,
262 TP_PROTO(struct hrtimer
*hrtimer
),
268 * itimer_state - called when itimer is started or canceled
269 * @which: name of the interval timer
270 * @value: the itimers value, itimer is canceled if value->it_value is
271 * zero, otherwise it is started
272 * @expires: the itimers expiry time
274 LTTNG_TRACEPOINT_EVENT(itimer_state
,
276 TP_PROTO(int which
, const struct itimerval
*const value
,
279 TP_ARGS(which
, value
, expires
),
282 __field( int, which
)
283 __field( cputime_t
, expires
)
284 __field( long, value_sec
)
285 __field( long, value_usec
)
286 __field( long, interval_sec
)
287 __field( long, interval_usec
)
291 tp_assign(which
, which
)
292 tp_assign(expires
, expires
)
293 tp_assign(value_sec
, value
->it_value
.tv_sec
)
294 tp_assign(value_usec
, value
->it_value
.tv_usec
)
295 tp_assign(interval_sec
, value
->it_interval
.tv_sec
)
296 tp_assign(interval_usec
, value
->it_interval
.tv_usec
)
299 TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
300 __entry
->which
, (unsigned long long)__entry
->expires
,
301 __entry
->value_sec
, __entry
->value_usec
,
302 __entry
->interval_sec
, __entry
->interval_usec
)
306 * itimer_expire - called when itimer expires
307 * @which: type of the interval timer
308 * @pid: pid of the process which owns the timer
309 * @now: current time, used to calculate the latency of itimer
311 LTTNG_TRACEPOINT_EVENT(itimer_expire
,
313 TP_PROTO(int which
, struct pid
*pid
, cputime_t now
),
315 TP_ARGS(which
, pid
, now
),
318 __field( int , which
)
319 __field( pid_t
, pid
)
320 __field( cputime_t
, now
)
324 tp_assign(which
, which
)
326 tp_assign(pid
, pid_nr(pid
))
329 TP_printk("which=%d pid=%d now=%llu", __entry
->which
,
330 (int) __entry
->pid
, (unsigned long long)__entry
->now
)
333 #endif /* LTTNG_TRACE_TIMER_H */
335 /* This part must be outside protection */
336 #include "../../../probes/define_trace.h"
This page took 0.035553 seconds and 4 git commands to generate.