xref: /openbmc/linux/include/trace/events/timer.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
22b022e3dSXiao Guangrong #undef TRACE_SYSTEM
32b022e3dSXiao Guangrong #define TRACE_SYSTEM timer
42b022e3dSXiao Guangrong 
52b022e3dSXiao Guangrong #if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
62b022e3dSXiao Guangrong #define _TRACE_TIMER_H
72b022e3dSXiao Guangrong 
82b022e3dSXiao Guangrong #include <linux/tracepoint.h>
9c6a2a177SXiao Guangrong #include <linux/hrtimer.h>
102b022e3dSXiao Guangrong #include <linux/timer.h>
112b022e3dSXiao Guangrong 
12363d0f64SLi Zefan DECLARE_EVENT_CLASS(timer_class,
132b022e3dSXiao Guangrong 
142b022e3dSXiao Guangrong 	TP_PROTO(struct timer_list *timer),
152b022e3dSXiao Guangrong 
162b022e3dSXiao Guangrong 	TP_ARGS(timer),
172b022e3dSXiao Guangrong 
182b022e3dSXiao Guangrong 	TP_STRUCT__entry(
192b022e3dSXiao Guangrong 		__field( void *,	timer	)
202b022e3dSXiao Guangrong 	),
212b022e3dSXiao Guangrong 
222b022e3dSXiao Guangrong 	TP_fast_assign(
232b022e3dSXiao Guangrong 		__entry->timer	= timer;
242b022e3dSXiao Guangrong 	),
252b022e3dSXiao Guangrong 
26434a83c3SIngo Molnar 	TP_printk("timer=%p", __entry->timer)
272b022e3dSXiao Guangrong );
282b022e3dSXiao Guangrong 
292b022e3dSXiao Guangrong /**
30363d0f64SLi Zefan  * timer_init - called when the timer is initialized
31363d0f64SLi Zefan  * @timer:	pointer to struct timer_list
32363d0f64SLi Zefan  */
33363d0f64SLi Zefan DEFINE_EVENT(timer_class, timer_init,
34363d0f64SLi Zefan 
35363d0f64SLi Zefan 	TP_PROTO(struct timer_list *timer),
36363d0f64SLi Zefan 
37363d0f64SLi Zefan 	TP_ARGS(timer)
38363d0f64SLi Zefan );
39363d0f64SLi Zefan 
408a58a34bSThomas Gleixner #define decode_timer_flags(flags)			\
418a58a34bSThomas Gleixner 	__print_flags(flags, "|",			\
428a58a34bSThomas Gleixner 		{  TIMER_MIGRATING,	"M" },		\
438a58a34bSThomas Gleixner 		{  TIMER_DEFERRABLE,	"D" },		\
448a58a34bSThomas Gleixner 		{  TIMER_PINNED,	"P" },		\
458a58a34bSThomas Gleixner 		{  TIMER_IRQSAFE,	"I" })
468a58a34bSThomas Gleixner 
47363d0f64SLi Zefan /**
482b022e3dSXiao Guangrong  * timer_start - called when the timer is started
492b022e3dSXiao Guangrong  * @timer:	pointer to struct timer_list
502b022e3dSXiao Guangrong  * @expires:	the timers expiry time
51fde33ca4SAnna-Maria Behnsen  * @flags:	the timers flags
522b022e3dSXiao Guangrong  */
532b022e3dSXiao Guangrong TRACE_EVENT(timer_start,
542b022e3dSXiao Guangrong 
554e413e85SBadhri Jagan Sridharan 	TP_PROTO(struct timer_list *timer,
564e413e85SBadhri Jagan Sridharan 		unsigned long expires,
570eeda71bSThomas Gleixner 		unsigned int flags),
582b022e3dSXiao Guangrong 
590eeda71bSThomas Gleixner 	TP_ARGS(timer, expires, flags),
602b022e3dSXiao Guangrong 
612b022e3dSXiao Guangrong 	TP_STRUCT__entry(
622b022e3dSXiao Guangrong 		__field( void *,	timer		)
632b022e3dSXiao Guangrong 		__field( void *,	function	)
642b022e3dSXiao Guangrong 		__field( unsigned long,	expires		)
652b022e3dSXiao Guangrong 		__field( unsigned long,	now		)
660eeda71bSThomas Gleixner 		__field( unsigned int,	flags		)
672b022e3dSXiao Guangrong 	),
682b022e3dSXiao Guangrong 
692b022e3dSXiao Guangrong 	TP_fast_assign(
702b022e3dSXiao Guangrong 		__entry->timer		= timer;
712b022e3dSXiao Guangrong 		__entry->function	= timer->function;
722b022e3dSXiao Guangrong 		__entry->expires	= expires;
732b022e3dSXiao Guangrong 		__entry->now		= jiffies;
740eeda71bSThomas Gleixner 		__entry->flags		= flags;
752b022e3dSXiao Guangrong 	),
762b022e3dSXiao Guangrong 
776849cbb0SAnna-Maria Gleixner 	TP_printk("timer=%p function=%ps expires=%lu [timeout=%ld] cpu=%u idx=%u flags=%s",
782b022e3dSXiao Guangrong 		  __entry->timer, __entry->function, __entry->expires,
798a58a34bSThomas Gleixner 		  (long)__entry->expires - __entry->now,
808a58a34bSThomas Gleixner 		  __entry->flags & TIMER_CPUMASK,
818a58a34bSThomas Gleixner 		  __entry->flags >> TIMER_ARRAYSHIFT,
828a58a34bSThomas Gleixner 		  decode_timer_flags(__entry->flags & TIMER_TRACE_FLAGMASK))
832b022e3dSXiao Guangrong );
842b022e3dSXiao Guangrong 
852b022e3dSXiao Guangrong /**
862b022e3dSXiao Guangrong  * timer_expire_entry - called immediately before the timer callback
872b022e3dSXiao Guangrong  * @timer:	pointer to struct timer_list
88fde33ca4SAnna-Maria Behnsen  * @baseclk:	value of timer_base::clk when timer expires
892b022e3dSXiao Guangrong  *
902b022e3dSXiao Guangrong  * Allows to determine the timer latency.
912b022e3dSXiao Guangrong  */
922b022e3dSXiao Guangrong TRACE_EVENT(timer_expire_entry,
932b022e3dSXiao Guangrong 
94f28d3d53SAnna-Maria Gleixner 	TP_PROTO(struct timer_list *timer, unsigned long baseclk),
952b022e3dSXiao Guangrong 
96f28d3d53SAnna-Maria Gleixner 	TP_ARGS(timer, baseclk),
972b022e3dSXiao Guangrong 
982b022e3dSXiao Guangrong 	TP_STRUCT__entry(
992b022e3dSXiao Guangrong 		__field( void *,	timer	)
1002b022e3dSXiao Guangrong 		__field( unsigned long,	now	)
101ede1b429SArjan van de Ven 		__field( void *,	function)
102f28d3d53SAnna-Maria Gleixner 		__field( unsigned long,	baseclk	)
1032b022e3dSXiao Guangrong 	),
1042b022e3dSXiao Guangrong 
1052b022e3dSXiao Guangrong 	TP_fast_assign(
1062b022e3dSXiao Guangrong 		__entry->timer		= timer;
1072b022e3dSXiao Guangrong 		__entry->now		= jiffies;
108ede1b429SArjan van de Ven 		__entry->function	= timer->function;
109f28d3d53SAnna-Maria Gleixner 		__entry->baseclk	= baseclk;
1102b022e3dSXiao Guangrong 	),
1112b022e3dSXiao Guangrong 
112f28d3d53SAnna-Maria Gleixner 	TP_printk("timer=%p function=%ps now=%lu baseclk=%lu",
113f28d3d53SAnna-Maria Gleixner 		  __entry->timer, __entry->function, __entry->now,
114f28d3d53SAnna-Maria Gleixner 		  __entry->baseclk)
1152b022e3dSXiao Guangrong );
1162b022e3dSXiao Guangrong 
1172b022e3dSXiao Guangrong /**
1182b022e3dSXiao Guangrong  * timer_expire_exit - called immediately after the timer callback returns
1192b022e3dSXiao Guangrong  * @timer:	pointer to struct timer_list
1202b022e3dSXiao Guangrong  *
1212b022e3dSXiao Guangrong  * When used in combination with the timer_expire_entry tracepoint we can
1222b022e3dSXiao Guangrong  * determine the runtime of the timer callback function.
1232b022e3dSXiao Guangrong  *
124f2cc020dSIngo Molnar  * NOTE: Do NOT dereference timer in TP_fast_assign. The pointer might
1252b022e3dSXiao Guangrong  * be invalid. We solely track the pointer.
1262b022e3dSXiao Guangrong  */
127363d0f64SLi Zefan DEFINE_EVENT(timer_class, timer_expire_exit,
1282b022e3dSXiao Guangrong 
1292b022e3dSXiao Guangrong 	TP_PROTO(struct timer_list *timer),
1302b022e3dSXiao Guangrong 
131363d0f64SLi Zefan 	TP_ARGS(timer)
1322b022e3dSXiao Guangrong );
1332b022e3dSXiao Guangrong 
1342b022e3dSXiao Guangrong /**
1352b022e3dSXiao Guangrong  * timer_cancel - called when the timer is canceled
1362b022e3dSXiao Guangrong  * @timer:	pointer to struct timer_list
1372b022e3dSXiao Guangrong  */
138363d0f64SLi Zefan DEFINE_EVENT(timer_class, timer_cancel,
1392b022e3dSXiao Guangrong 
1402b022e3dSXiao Guangrong 	TP_PROTO(struct timer_list *timer),
1412b022e3dSXiao Guangrong 
142363d0f64SLi Zefan 	TP_ARGS(timer)
1432b022e3dSXiao Guangrong );
1442b022e3dSXiao Guangrong 
14591633eedSAnna-Maria Gleixner #define decode_clockid(type)						\
14691633eedSAnna-Maria Gleixner 	__print_symbolic(type,						\
14791633eedSAnna-Maria Gleixner 		{ CLOCK_REALTIME,	"CLOCK_REALTIME"	},	\
14891633eedSAnna-Maria Gleixner 		{ CLOCK_MONOTONIC,	"CLOCK_MONOTONIC"	},	\
14991633eedSAnna-Maria Gleixner 		{ CLOCK_BOOTTIME,	"CLOCK_BOOTTIME"	},	\
15091633eedSAnna-Maria Gleixner 		{ CLOCK_TAI,		"CLOCK_TAI"		})
15191633eedSAnna-Maria Gleixner 
15291633eedSAnna-Maria Gleixner #define decode_hrtimer_mode(mode)					\
15391633eedSAnna-Maria Gleixner 	__print_symbolic(mode,						\
15491633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS,		"ABS"		},	\
15591633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_REL,		"REL"		},	\
15691633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_PINNED,	"ABS|PINNED"	},	\
15798ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_REL_PINNED,	"REL|PINNED"	},	\
15898ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_SOFT,	"ABS|SOFT"	},	\
15998ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_REL_SOFT,	"REL|SOFT"	},	\
16098ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_PINNED_SOFT,	"ABS|PINNED|SOFT" },	\
16198ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_REL_PINNED_SOFT,	"REL|PINNED|SOFT" },	\
16291633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_HARD,	"ABS|HARD" },		\
163c6a2a177SXiao Guangrong 		{ HRTIMER_MODE_REL_HARD,	"REL|HARD" },		\
164c6a2a177SXiao Guangrong 		{ HRTIMER_MODE_ABS_PINNED_HARD, "ABS|PINNED|HARD" },	\
165cf2fbdd2SMasanari Iida 		{ HRTIMER_MODE_REL_PINNED_HARD,	"REL|PINNED|HARD" })
166c6a2a177SXiao Guangrong 
167c6a2a177SXiao Guangrong /**
168c6a2a177SXiao Guangrong  * hrtimer_init - called when the hrtimer is initialized
169c6a2a177SXiao Guangrong  * @hrtimer:	pointer to struct hrtimer
170c6a2a177SXiao Guangrong  * @clockid:	the hrtimers clock
171434a83c3SIngo Molnar  * @mode:	the hrtimers mode
172c6a2a177SXiao Guangrong  */
173c6a2a177SXiao Guangrong TRACE_EVENT(hrtimer_init,
174434a83c3SIngo Molnar 
175c6a2a177SXiao Guangrong 	TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
176c6a2a177SXiao Guangrong 		 enum hrtimer_mode mode),
177434a83c3SIngo Molnar 
178c6a2a177SXiao Guangrong 	TP_ARGS(hrtimer, clockid, mode),
179c6a2a177SXiao Guangrong 
180c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
181c6a2a177SXiao Guangrong 		__field( void *,		hrtimer		)
182c6a2a177SXiao Guangrong 		__field( clockid_t,		clockid		)
183434a83c3SIngo Molnar 		__field( enum hrtimer_mode,	mode		)
184c6a2a177SXiao Guangrong 	),
185c6a2a177SXiao Guangrong 
186c6a2a177SXiao Guangrong 	TP_fast_assign(
187c6a2a177SXiao Guangrong 		__entry->hrtimer	= hrtimer;
188434a83c3SIngo Molnar 		__entry->clockid	= clockid;
18991633eedSAnna-Maria Gleixner 		__entry->mode		= mode;
19091633eedSAnna-Maria Gleixner 	),
191c6a2a177SXiao Guangrong 
192c6a2a177SXiao Guangrong 	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
193c6a2a177SXiao Guangrong 		  decode_clockid(__entry->clockid),
194c6a2a177SXiao Guangrong 		  decode_hrtimer_mode(__entry->mode))
195cf2fbdd2SMasanari Iida );
196fde33ca4SAnna-Maria Behnsen 
197c6a2a177SXiao Guangrong /**
198c6a2a177SXiao Guangrong  * hrtimer_start - called when the hrtimer is started
199c6a2a177SXiao Guangrong  * @hrtimer:	pointer to struct hrtimer
20063e2ed36SAnna-Maria Gleixner  * @mode:	the hrtimers mode
201c6a2a177SXiao Guangrong  */
20263e2ed36SAnna-Maria Gleixner TRACE_EVENT(hrtimer_start,
203c6a2a177SXiao Guangrong 
204c6a2a177SXiao Guangrong 	TP_PROTO(struct hrtimer *hrtimer, enum hrtimer_mode mode),
205434a83c3SIngo Molnar 
206c6a2a177SXiao Guangrong 	TP_ARGS(hrtimer, mode),
207c6a2a177SXiao Guangrong 
208c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
20963e2ed36SAnna-Maria Gleixner 		__field( void *,	hrtimer		)
210c6a2a177SXiao Guangrong 		__field( void *,	function	)
211c6a2a177SXiao Guangrong 		__field( s64,		expires		)
212c6a2a177SXiao Guangrong 		__field( s64,		softexpires	)
213434a83c3SIngo Molnar 		__field( enum hrtimer_mode,	mode	)
214434a83c3SIngo Molnar 	),
2152456e855SThomas Gleixner 
2162456e855SThomas Gleixner 	TP_fast_assign(
21763e2ed36SAnna-Maria Gleixner 		__entry->hrtimer	= hrtimer;
218c6a2a177SXiao Guangrong 		__entry->function	= hrtimer->function;
219c6a2a177SXiao Guangrong 		__entry->expires	= hrtimer_get_expires(hrtimer);
2206849cbb0SAnna-Maria Gleixner 		__entry->softexpires	= hrtimer_get_softexpires(hrtimer);
22163e2ed36SAnna-Maria Gleixner 		__entry->mode		= mode;
2222456e855SThomas Gleixner 	),
22363e2ed36SAnna-Maria Gleixner 
22463e2ed36SAnna-Maria Gleixner 	TP_printk("hrtimer=%p function=%ps expires=%llu softexpires=%llu "
225c6a2a177SXiao Guangrong 		  "mode=%s", __entry->hrtimer, __entry->function,
226c6a2a177SXiao Guangrong 		  (unsigned long long) __entry->expires,
227c6a2a177SXiao Guangrong 		  (unsigned long long) __entry->softexpires,
228cf2fbdd2SMasanari Iida 		  decode_hrtimer_mode(__entry->mode))
229cf2fbdd2SMasanari Iida );
230c6a2a177SXiao Guangrong 
231c6a2a177SXiao Guangrong /**
232c6a2a177SXiao Guangrong  * hrtimer_expire_entry - called immediately before the hrtimer callback
233c6a2a177SXiao Guangrong  * @hrtimer:	pointer to struct hrtimer
234c6a2a177SXiao Guangrong  * @now:	pointer to variable which contains current time of the
235c6a2a177SXiao Guangrong  *		timers base.
236c6a2a177SXiao Guangrong  *
237434a83c3SIngo Molnar  * Allows to determine the timer latency.
238c6a2a177SXiao Guangrong  */
239434a83c3SIngo Molnar TRACE_EVENT(hrtimer_expire_entry,
240c6a2a177SXiao Guangrong 
241c6a2a177SXiao Guangrong 	TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
242434a83c3SIngo Molnar 
243c6a2a177SXiao Guangrong 	TP_ARGS(hrtimer, now),
244ede1b429SArjan van de Ven 
245c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
246c6a2a177SXiao Guangrong 		__field( void *,	hrtimer	)
247c6a2a177SXiao Guangrong 		__field( s64,		now	)
248434a83c3SIngo Molnar 		__field( void *,	function)
2492456e855SThomas Gleixner 	),
250ede1b429SArjan van de Ven 
251c6a2a177SXiao Guangrong 	TP_fast_assign(
252c6a2a177SXiao Guangrong 		__entry->hrtimer	= hrtimer;
2536849cbb0SAnna-Maria Gleixner 		__entry->now		= *now;
2546849cbb0SAnna-Maria Gleixner 		__entry->function	= hrtimer->function;
2552456e855SThomas Gleixner 	),
256c6a2a177SXiao Guangrong 
257c6a2a177SXiao Guangrong 	TP_printk("hrtimer=%p function=%ps now=%llu",
258363d0f64SLi Zefan 		  __entry->hrtimer, __entry->function,
259c6a2a177SXiao Guangrong 		  (unsigned long long) __entry->now)
260434a83c3SIngo Molnar );
261c6a2a177SXiao Guangrong 
262434a83c3SIngo Molnar DECLARE_EVENT_CLASS(hrtimer_class,
263c6a2a177SXiao Guangrong 
264c6a2a177SXiao Guangrong 	TP_PROTO(struct hrtimer *hrtimer),
265434a83c3SIngo Molnar 
266c6a2a177SXiao Guangrong 	TP_ARGS(hrtimer),
267c6a2a177SXiao Guangrong 
268c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
269434a83c3SIngo Molnar 		__field( void *,	hrtimer	)
270c6a2a177SXiao Guangrong 	),
271c6a2a177SXiao Guangrong 
272434a83c3SIngo Molnar 	TP_fast_assign(
273c6a2a177SXiao Guangrong 		__entry->hrtimer	= hrtimer;
274c6a2a177SXiao Guangrong 	),
275c6a2a177SXiao Guangrong 
276363d0f64SLi Zefan 	TP_printk("hrtimer=%p", __entry->hrtimer)
277cf2fbdd2SMasanari Iida );
278363d0f64SLi Zefan 
279363d0f64SLi Zefan /**
280363d0f64SLi Zefan  * hrtimer_expire_exit - called immediately after the hrtimer callback returns
281c6a2a177SXiao Guangrong  * @hrtimer:	pointer to struct hrtimer
282363d0f64SLi Zefan  *
283c6a2a177SXiao Guangrong  * When used in combination with the hrtimer_expire_entry tracepoint we can
284434a83c3SIngo Molnar  * determine the runtime of the callback function.
285c6a2a177SXiao Guangrong  */
286363d0f64SLi Zefan DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit,
287363d0f64SLi Zefan 
288c6a2a177SXiao Guangrong 	TP_PROTO(struct hrtimer *hrtimer),
289363d0f64SLi Zefan 
290363d0f64SLi Zefan 	TP_ARGS(hrtimer)
291363d0f64SLi Zefan );
292363d0f64SLi Zefan 
293363d0f64SLi Zefan /**
294c6a2a177SXiao Guangrong  * hrtimer_cancel - called when the hrtimer is canceled
295363d0f64SLi Zefan  * @hrtimer:	pointer to struct hrtimer
296c6a2a177SXiao Guangrong  */
297363d0f64SLi Zefan DEFINE_EVENT(hrtimer_class, hrtimer_cancel,
298c6a2a177SXiao Guangrong 
299c6a2a177SXiao Guangrong 	TP_PROTO(struct hrtimer *hrtimer),
3003f0a525eSXiao Guangrong 
3013f0a525eSXiao Guangrong 	TP_ARGS(hrtimer)
3023f0a525eSXiao Guangrong );
3033f0a525eSXiao Guangrong 
3043f0a525eSXiao Guangrong /**
3053f0a525eSXiao Guangrong  * itimer_state - called when itimer is started or canceled
3063f0a525eSXiao Guangrong  * @which:	name of the interval timer
3073f0a525eSXiao Guangrong  * @value:	the itimers value, itimer is canceled if value->it_value is
3083f0a525eSXiao Guangrong  *		zero, otherwise it is started
309bd40a175SArnd Bergmann  * @expires:	the itimers expiry time
310858cf3a8SFrederic Weisbecker  */
3113f0a525eSXiao Guangrong TRACE_EVENT(itimer_state,
3123f0a525eSXiao Guangrong 
3133f0a525eSXiao Guangrong 	TP_PROTO(int which, const struct itimerspec64 *const value,
3143f0a525eSXiao Guangrong 		 unsigned long long expires),
3153f0a525eSXiao Guangrong 
316858cf3a8SFrederic Weisbecker 	TP_ARGS(which, value, expires),
3173f0a525eSXiao Guangrong 
318bd40a175SArnd Bergmann 	TP_STRUCT__entry(
3193f0a525eSXiao Guangrong 		__field(	int,			which		)
320bd40a175SArnd Bergmann 		__field(	unsigned long long,	expires		)
3213f0a525eSXiao Guangrong 		__field(	long,			value_sec	)
3223f0a525eSXiao Guangrong 		__field(	long,			value_nsec	)
3233f0a525eSXiao Guangrong 		__field(	long,			interval_sec	)
3243f0a525eSXiao Guangrong 		__field(	long,			interval_nsec	)
3253f0a525eSXiao Guangrong 	),
3263f0a525eSXiao Guangrong 
327bd40a175SArnd Bergmann 	TP_fast_assign(
3283f0a525eSXiao Guangrong 		__entry->which		= which;
329bd40a175SArnd Bergmann 		__entry->expires	= expires;
3303f0a525eSXiao Guangrong 		__entry->value_sec	= value->it_value.tv_sec;
3313f0a525eSXiao Guangrong 		__entry->value_nsec	= value->it_value.tv_nsec;
332bd40a175SArnd Bergmann 		__entry->interval_sec	= value->it_interval.tv_sec;
333858cf3a8SFrederic Weisbecker 		__entry->interval_nsec	= value->it_interval.tv_nsec;
334bd40a175SArnd Bergmann 	),
335bd40a175SArnd Bergmann 
3363f0a525eSXiao Guangrong 	TP_printk("which=%d expires=%llu it_value=%ld.%06ld it_interval=%ld.%06ld",
3373f0a525eSXiao Guangrong 		  __entry->which, __entry->expires,
3383f0a525eSXiao Guangrong 		  __entry->value_sec, __entry->value_nsec / NSEC_PER_USEC,
3393f0a525eSXiao Guangrong 		  __entry->interval_sec, __entry->interval_nsec / NSEC_PER_USEC)
3403f0a525eSXiao Guangrong );
3413f0a525eSXiao Guangrong 
3423f0a525eSXiao Guangrong /**
3433f0a525eSXiao Guangrong  * itimer_expire - called when itimer expires
3443f0a525eSXiao Guangrong  * @which:	type of the interval timer
3453f0a525eSXiao Guangrong  * @pid:	pid of the process which owns the timer
346858cf3a8SFrederic Weisbecker  * @now:	current time, used to calculate the latency of itimer
3473f0a525eSXiao Guangrong  */
3483f0a525eSXiao Guangrong TRACE_EVENT(itimer_expire,
3493f0a525eSXiao Guangrong 
3503f0a525eSXiao Guangrong 	TP_PROTO(int which, struct pid *pid, unsigned long long now),
3513f0a525eSXiao Guangrong 
3523f0a525eSXiao Guangrong 	TP_ARGS(which, pid, now),
353858cf3a8SFrederic Weisbecker 
3543f0a525eSXiao Guangrong 	TP_STRUCT__entry(
3553f0a525eSXiao Guangrong 		__field( int ,			which	)
3563f0a525eSXiao Guangrong 		__field( pid_t,			pid	)
3573f0a525eSXiao Guangrong 		__field( unsigned long long,	now	)
3583f0a525eSXiao Guangrong 	),
3593f0a525eSXiao Guangrong 
3603f0a525eSXiao Guangrong 	TP_fast_assign(
3613f0a525eSXiao Guangrong 		__entry->which	= which;
362e9c0748bSThomas Gleixner 		__entry->now	= now;
363858cf3a8SFrederic Weisbecker 		__entry->pid	= pid_nr(pid);
3643f0a525eSXiao Guangrong 	),
3653f0a525eSXiao Guangrong 
3662c82d1beSFrederic Weisbecker 	TP_printk("which=%d pid=%d now=%llu", __entry->which,
367e6e6cc22SFrederic Weisbecker 		  (int) __entry->pid, __entry->now)
368e6e6cc22SFrederic Weisbecker );
369c87edb36SSteven Rostedt (Red Hat) 
370e6e6cc22SFrederic Weisbecker #ifdef CONFIG_NO_HZ_COMMON
371e6e6cc22SFrederic Weisbecker 
372e6e6cc22SFrederic Weisbecker #define TICK_DEP_NAMES					\
37301b4c399SFrederic Weisbecker 		tick_dep_mask_name(NONE)		\
374*db7b464dSZqiang 		tick_dep_name(POSIX_TIMER)		\
375*db7b464dSZqiang 		tick_dep_name(PERF_EVENTS)		\
376e6e6cc22SFrederic Weisbecker 		tick_dep_name(SCHED)			\
377e6e6cc22SFrederic Weisbecker 		tick_dep_name(CLOCK_UNSTABLE)		\
378c87edb36SSteven Rostedt (Red Hat) 		tick_dep_name(RCU)			\
379e6e6cc22SFrederic Weisbecker 		tick_dep_name_end(RCU_EXP)
380e6e6cc22SFrederic Weisbecker 
381c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_name
382c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_mask_name
383c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_name_end
384c87edb36SSteven Rostedt (Red Hat) 
385c87edb36SSteven Rostedt (Red Hat) /* The MASK will convert to their bits and they need to be processed too */
386c87edb36SSteven Rostedt (Red Hat) #define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
387c87edb36SSteven Rostedt (Red Hat) 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
388e6e6cc22SFrederic Weisbecker #define tick_dep_name_end(sdep)  TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
389e6e6cc22SFrederic Weisbecker 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
390e6e6cc22SFrederic Weisbecker /* NONE only has a mask defined for it */
391e6e6cc22SFrederic Weisbecker #define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
392c87edb36SSteven Rostedt (Red Hat) 
393e6e6cc22SFrederic Weisbecker TICK_DEP_NAMES
394e6e6cc22SFrederic Weisbecker 
395e6e6cc22SFrederic Weisbecker #undef tick_dep_name
396c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_mask_name
397e6e6cc22SFrederic Weisbecker #undef tick_dep_name_end
398e6e6cc22SFrederic Weisbecker 
399e6e6cc22SFrederic Weisbecker #define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
400e6e6cc22SFrederic Weisbecker #define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
401e6e6cc22SFrederic Weisbecker #define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep }
402cb41a290SFrederic Weisbecker 
403cb41a290SFrederic Weisbecker #define show_tick_dep_name(val)				\
404e6e6cc22SFrederic Weisbecker 	__print_symbolic(val, TICK_DEP_NAMES)
405cb41a290SFrederic Weisbecker 
406e6e6cc22SFrederic Weisbecker TRACE_EVENT(tick_stop,
407cb41a290SFrederic Weisbecker 
408cb41a290SFrederic Weisbecker 	TP_PROTO(int success, int dependency),
409cb41a290SFrederic Weisbecker 
410e6e6cc22SFrederic Weisbecker 	TP_ARGS(success, dependency),
411cb41a290SFrederic Weisbecker 
412cb41a290SFrederic Weisbecker 	TP_STRUCT__entry(
413cb41a290SFrederic Weisbecker 		__field( int ,		success	)
414cb41a290SFrederic Weisbecker 		__field( int ,		dependency )
415e6e6cc22SFrederic Weisbecker 	),
416cb41a290SFrederic Weisbecker 
417cb41a290SFrederic Weisbecker 	TP_fast_assign(
418e6e6cc22SFrederic Weisbecker 		__entry->success	= success;
419e6e6cc22SFrederic Weisbecker 		__entry->dependency	= dependency;
420cb41a290SFrederic Weisbecker 	),
421cb41a290SFrederic Weisbecker 
422cb41a290SFrederic Weisbecker 	TP_printk("success=%d dependency=%s",  __entry->success, \
4232b022e3dSXiao Guangrong 			show_tick_dep_name(__entry->dependency))
4242b022e3dSXiao Guangrong );
4252b022e3dSXiao Guangrong #endif
4262b022e3dSXiao Guangrong 
427 #endif /*  _TRACE_TIMER_H */
428 
429 /* This part must be outside protection */
430 #include <trace/define_trace.h>
431