xref: /openbmc/linux/include/trace/events/timer.h (revision 91633eed73a3ac37aaece5c8c1f93a18bae616a9)
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
512b022e3dSXiao Guangrong  */
522b022e3dSXiao Guangrong TRACE_EVENT(timer_start,
532b022e3dSXiao Guangrong 
544e413e85SBadhri Jagan Sridharan 	TP_PROTO(struct timer_list *timer,
554e413e85SBadhri Jagan Sridharan 		unsigned long expires,
560eeda71bSThomas Gleixner 		unsigned int flags),
572b022e3dSXiao Guangrong 
580eeda71bSThomas Gleixner 	TP_ARGS(timer, expires, flags),
592b022e3dSXiao Guangrong 
602b022e3dSXiao Guangrong 	TP_STRUCT__entry(
612b022e3dSXiao Guangrong 		__field( void *,	timer		)
622b022e3dSXiao Guangrong 		__field( void *,	function	)
632b022e3dSXiao Guangrong 		__field( unsigned long,	expires		)
642b022e3dSXiao Guangrong 		__field( unsigned long,	now		)
650eeda71bSThomas Gleixner 		__field( unsigned int,	flags		)
662b022e3dSXiao Guangrong 	),
672b022e3dSXiao Guangrong 
682b022e3dSXiao Guangrong 	TP_fast_assign(
692b022e3dSXiao Guangrong 		__entry->timer		= timer;
702b022e3dSXiao Guangrong 		__entry->function	= timer->function;
712b022e3dSXiao Guangrong 		__entry->expires	= expires;
722b022e3dSXiao Guangrong 		__entry->now		= jiffies;
730eeda71bSThomas Gleixner 		__entry->flags		= flags;
742b022e3dSXiao Guangrong 	),
752b022e3dSXiao Guangrong 
768a58a34bSThomas Gleixner 	TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld] cpu=%u idx=%u flags=%s",
772b022e3dSXiao Guangrong 		  __entry->timer, __entry->function, __entry->expires,
788a58a34bSThomas Gleixner 		  (long)__entry->expires - __entry->now,
798a58a34bSThomas Gleixner 		  __entry->flags & TIMER_CPUMASK,
808a58a34bSThomas Gleixner 		  __entry->flags >> TIMER_ARRAYSHIFT,
818a58a34bSThomas Gleixner 		  decode_timer_flags(__entry->flags & TIMER_TRACE_FLAGMASK))
822b022e3dSXiao Guangrong );
832b022e3dSXiao Guangrong 
842b022e3dSXiao Guangrong /**
852b022e3dSXiao Guangrong  * timer_expire_entry - called immediately before the timer callback
862b022e3dSXiao Guangrong  * @timer:	pointer to struct timer_list
872b022e3dSXiao Guangrong  *
882b022e3dSXiao Guangrong  * Allows to determine the timer latency.
892b022e3dSXiao Guangrong  */
902b022e3dSXiao Guangrong TRACE_EVENT(timer_expire_entry,
912b022e3dSXiao Guangrong 
922b022e3dSXiao Guangrong 	TP_PROTO(struct timer_list *timer),
932b022e3dSXiao Guangrong 
942b022e3dSXiao Guangrong 	TP_ARGS(timer),
952b022e3dSXiao Guangrong 
962b022e3dSXiao Guangrong 	TP_STRUCT__entry(
972b022e3dSXiao Guangrong 		__field( void *,	timer	)
982b022e3dSXiao Guangrong 		__field( unsigned long,	now	)
99ede1b429SArjan van de Ven 		__field( void *,	function)
1002b022e3dSXiao Guangrong 	),
1012b022e3dSXiao Guangrong 
1022b022e3dSXiao Guangrong 	TP_fast_assign(
1032b022e3dSXiao Guangrong 		__entry->timer		= timer;
1042b022e3dSXiao Guangrong 		__entry->now		= jiffies;
105ede1b429SArjan van de Ven 		__entry->function	= timer->function;
1062b022e3dSXiao Guangrong 	),
1072b022e3dSXiao Guangrong 
108ede1b429SArjan van de Ven 	TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now)
1092b022e3dSXiao Guangrong );
1102b022e3dSXiao Guangrong 
1112b022e3dSXiao Guangrong /**
1122b022e3dSXiao Guangrong  * timer_expire_exit - called immediately after the timer callback returns
1132b022e3dSXiao Guangrong  * @timer:	pointer to struct timer_list
1142b022e3dSXiao Guangrong  *
1152b022e3dSXiao Guangrong  * When used in combination with the timer_expire_entry tracepoint we can
1162b022e3dSXiao Guangrong  * determine the runtime of the timer callback function.
1172b022e3dSXiao Guangrong  *
1182b022e3dSXiao Guangrong  * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
1192b022e3dSXiao Guangrong  * be invalid. We solely track the pointer.
1202b022e3dSXiao Guangrong  */
121363d0f64SLi Zefan DEFINE_EVENT(timer_class, timer_expire_exit,
1222b022e3dSXiao Guangrong 
1232b022e3dSXiao Guangrong 	TP_PROTO(struct timer_list *timer),
1242b022e3dSXiao Guangrong 
125363d0f64SLi Zefan 	TP_ARGS(timer)
1262b022e3dSXiao Guangrong );
1272b022e3dSXiao Guangrong 
1282b022e3dSXiao Guangrong /**
1292b022e3dSXiao Guangrong  * timer_cancel - called when the timer is canceled
1302b022e3dSXiao Guangrong  * @timer:	pointer to struct timer_list
1312b022e3dSXiao Guangrong  */
132363d0f64SLi Zefan DEFINE_EVENT(timer_class, timer_cancel,
1332b022e3dSXiao Guangrong 
1342b022e3dSXiao Guangrong 	TP_PROTO(struct timer_list *timer),
1352b022e3dSXiao Guangrong 
136363d0f64SLi Zefan 	TP_ARGS(timer)
1372b022e3dSXiao Guangrong );
1382b022e3dSXiao Guangrong 
139*91633eedSAnna-Maria Gleixner #define decode_clockid(type)						\
140*91633eedSAnna-Maria Gleixner 	__print_symbolic(type,						\
141*91633eedSAnna-Maria Gleixner 		{ CLOCK_REALTIME,	"CLOCK_REALTIME"	},	\
142*91633eedSAnna-Maria Gleixner 		{ CLOCK_MONOTONIC,	"CLOCK_MONOTONIC"	},	\
143*91633eedSAnna-Maria Gleixner 		{ CLOCK_BOOTTIME,	"CLOCK_BOOTTIME"	},	\
144*91633eedSAnna-Maria Gleixner 		{ CLOCK_TAI,		"CLOCK_TAI"		})
145*91633eedSAnna-Maria Gleixner 
146*91633eedSAnna-Maria Gleixner #define decode_hrtimer_mode(mode)					\
147*91633eedSAnna-Maria Gleixner 	__print_symbolic(mode,						\
148*91633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS,		"ABS"		},	\
149*91633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_REL,		"REL"		},	\
150*91633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_PINNED,	"ABS|PINNED"	},	\
151*91633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_REL_PINNED,	"REL|PINNED"	})
152*91633eedSAnna-Maria Gleixner 
153c6a2a177SXiao Guangrong /**
154c6a2a177SXiao Guangrong  * hrtimer_init - called when the hrtimer is initialized
155cf2fbdd2SMasanari Iida  * @hrtimer:	pointer to struct hrtimer
156c6a2a177SXiao Guangrong  * @clockid:	the hrtimers clock
157c6a2a177SXiao Guangrong  * @mode:	the hrtimers mode
158c6a2a177SXiao Guangrong  */
159c6a2a177SXiao Guangrong TRACE_EVENT(hrtimer_init,
160c6a2a177SXiao Guangrong 
161434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
162c6a2a177SXiao Guangrong 		 enum hrtimer_mode mode),
163c6a2a177SXiao Guangrong 
164434a83c3SIngo Molnar 	TP_ARGS(hrtimer, clockid, mode),
165c6a2a177SXiao Guangrong 
166c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
167434a83c3SIngo Molnar 		__field( void *,		hrtimer		)
168c6a2a177SXiao Guangrong 		__field( clockid_t,		clockid		)
169c6a2a177SXiao Guangrong 		__field( enum hrtimer_mode,	mode		)
170c6a2a177SXiao Guangrong 	),
171c6a2a177SXiao Guangrong 
172c6a2a177SXiao Guangrong 	TP_fast_assign(
173434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
174c6a2a177SXiao Guangrong 		__entry->clockid	= clockid;
175c6a2a177SXiao Guangrong 		__entry->mode		= mode;
176c6a2a177SXiao Guangrong 	),
177c6a2a177SXiao Guangrong 
178434a83c3SIngo Molnar 	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
179*91633eedSAnna-Maria Gleixner 		  decode_clockid(__entry->clockid),
180*91633eedSAnna-Maria Gleixner 		  decode_hrtimer_mode(__entry->mode))
181c6a2a177SXiao Guangrong );
182c6a2a177SXiao Guangrong 
183c6a2a177SXiao Guangrong /**
184c6a2a177SXiao Guangrong  * hrtimer_start - called when the hrtimer is started
185cf2fbdd2SMasanari Iida  * @hrtimer: pointer to struct hrtimer
186c6a2a177SXiao Guangrong  */
187c6a2a177SXiao Guangrong TRACE_EVENT(hrtimer_start,
188c6a2a177SXiao Guangrong 
189434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer),
190c6a2a177SXiao Guangrong 
191434a83c3SIngo Molnar 	TP_ARGS(hrtimer),
192c6a2a177SXiao Guangrong 
193c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
194434a83c3SIngo Molnar 		__field( void *,	hrtimer		)
195c6a2a177SXiao Guangrong 		__field( void *,	function	)
196c6a2a177SXiao Guangrong 		__field( s64,		expires		)
197c6a2a177SXiao Guangrong 		__field( s64,		softexpires	)
198c6a2a177SXiao Guangrong 	),
199c6a2a177SXiao Guangrong 
200c6a2a177SXiao Guangrong 	TP_fast_assign(
201434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
202434a83c3SIngo Molnar 		__entry->function	= hrtimer->function;
2032456e855SThomas Gleixner 		__entry->expires	= hrtimer_get_expires(hrtimer);
2042456e855SThomas Gleixner 		__entry->softexpires	= hrtimer_get_softexpires(hrtimer);
205c6a2a177SXiao Guangrong 	),
206c6a2a177SXiao Guangrong 
207434a83c3SIngo Molnar 	TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
208434a83c3SIngo Molnar 		  __entry->hrtimer, __entry->function,
2092456e855SThomas Gleixner 		  (unsigned long long) __entry->expires,
2102456e855SThomas Gleixner 		  (unsigned long long) __entry->softexpires)
211c6a2a177SXiao Guangrong );
212c6a2a177SXiao Guangrong 
213c6a2a177SXiao Guangrong /**
214cf2fbdd2SMasanari Iida  * hrtimer_expire_entry - called immediately before the hrtimer callback
215cf2fbdd2SMasanari Iida  * @hrtimer:	pointer to struct hrtimer
216c6a2a177SXiao Guangrong  * @now:	pointer to variable which contains current time of the
217c6a2a177SXiao Guangrong  *		timers base.
218c6a2a177SXiao Guangrong  *
219c6a2a177SXiao Guangrong  * Allows to determine the timer latency.
220c6a2a177SXiao Guangrong  */
221c6a2a177SXiao Guangrong TRACE_EVENT(hrtimer_expire_entry,
222c6a2a177SXiao Guangrong 
223434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
224c6a2a177SXiao Guangrong 
225434a83c3SIngo Molnar 	TP_ARGS(hrtimer, now),
226c6a2a177SXiao Guangrong 
227c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
228434a83c3SIngo Molnar 		__field( void *,	hrtimer	)
229c6a2a177SXiao Guangrong 		__field( s64,		now	)
230ede1b429SArjan van de Ven 		__field( void *,	function)
231c6a2a177SXiao Guangrong 	),
232c6a2a177SXiao Guangrong 
233c6a2a177SXiao Guangrong 	TP_fast_assign(
234434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
2352456e855SThomas Gleixner 		__entry->now		= *now;
236ede1b429SArjan van de Ven 		__entry->function	= hrtimer->function;
237c6a2a177SXiao Guangrong 	),
238c6a2a177SXiao Guangrong 
239ede1b429SArjan van de Ven 	TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function,
2402456e855SThomas Gleixner 		  (unsigned long long) __entry->now)
241c6a2a177SXiao Guangrong );
242c6a2a177SXiao Guangrong 
243363d0f64SLi Zefan DECLARE_EVENT_CLASS(hrtimer_class,
244c6a2a177SXiao Guangrong 
245434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer),
246c6a2a177SXiao Guangrong 
247434a83c3SIngo Molnar 	TP_ARGS(hrtimer),
248c6a2a177SXiao Guangrong 
249c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
250434a83c3SIngo Molnar 		__field( void *,	hrtimer	)
251c6a2a177SXiao Guangrong 	),
252c6a2a177SXiao Guangrong 
253c6a2a177SXiao Guangrong 	TP_fast_assign(
254434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
255c6a2a177SXiao Guangrong 	),
256c6a2a177SXiao Guangrong 
257434a83c3SIngo Molnar 	TP_printk("hrtimer=%p", __entry->hrtimer)
258c6a2a177SXiao Guangrong );
259c6a2a177SXiao Guangrong 
260c6a2a177SXiao Guangrong /**
261363d0f64SLi Zefan  * hrtimer_expire_exit - called immediately after the hrtimer callback returns
262cf2fbdd2SMasanari Iida  * @hrtimer:	pointer to struct hrtimer
263363d0f64SLi Zefan  *
264363d0f64SLi Zefan  * When used in combination with the hrtimer_expire_entry tracepoint we can
265363d0f64SLi Zefan  * determine the runtime of the callback function.
266c6a2a177SXiao Guangrong  */
267363d0f64SLi Zefan DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit,
268c6a2a177SXiao Guangrong 
269434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer),
270c6a2a177SXiao Guangrong 
271363d0f64SLi Zefan 	TP_ARGS(hrtimer)
272363d0f64SLi Zefan );
273c6a2a177SXiao Guangrong 
274363d0f64SLi Zefan /**
275363d0f64SLi Zefan  * hrtimer_cancel - called when the hrtimer is canceled
276363d0f64SLi Zefan  * @hrtimer:	pointer to struct hrtimer
277363d0f64SLi Zefan  */
278363d0f64SLi Zefan DEFINE_EVENT(hrtimer_class, hrtimer_cancel,
279c6a2a177SXiao Guangrong 
280363d0f64SLi Zefan 	TP_PROTO(struct hrtimer *hrtimer),
281c6a2a177SXiao Guangrong 
282363d0f64SLi Zefan 	TP_ARGS(hrtimer)
283c6a2a177SXiao Guangrong );
284c6a2a177SXiao Guangrong 
2853f0a525eSXiao Guangrong /**
2863f0a525eSXiao Guangrong  * itimer_state - called when itimer is started or canceled
2873f0a525eSXiao Guangrong  * @which:	name of the interval timer
2883f0a525eSXiao Guangrong  * @value:	the itimers value, itimer is canceled if value->it_value is
2893f0a525eSXiao Guangrong  *		zero, otherwise it is started
2903f0a525eSXiao Guangrong  * @expires:	the itimers expiry time
2913f0a525eSXiao Guangrong  */
2923f0a525eSXiao Guangrong TRACE_EVENT(itimer_state,
2933f0a525eSXiao Guangrong 
2943f0a525eSXiao Guangrong 	TP_PROTO(int which, const struct itimerval *const value,
295858cf3a8SFrederic Weisbecker 		 unsigned long long expires),
2963f0a525eSXiao Guangrong 
2973f0a525eSXiao Guangrong 	TP_ARGS(which, value, expires),
2983f0a525eSXiao Guangrong 
2993f0a525eSXiao Guangrong 	TP_STRUCT__entry(
3003f0a525eSXiao Guangrong 		__field(	int,			which		)
301858cf3a8SFrederic Weisbecker 		__field(	unsigned long long,	expires		)
3023f0a525eSXiao Guangrong 		__field(	long,			value_sec	)
3033f0a525eSXiao Guangrong 		__field(	long,			value_usec	)
3043f0a525eSXiao Guangrong 		__field(	long,			interval_sec	)
3053f0a525eSXiao Guangrong 		__field(	long,			interval_usec	)
3063f0a525eSXiao Guangrong 	),
3073f0a525eSXiao Guangrong 
3083f0a525eSXiao Guangrong 	TP_fast_assign(
3093f0a525eSXiao Guangrong 		__entry->which		= which;
3103f0a525eSXiao Guangrong 		__entry->expires	= expires;
3113f0a525eSXiao Guangrong 		__entry->value_sec	= value->it_value.tv_sec;
3123f0a525eSXiao Guangrong 		__entry->value_usec	= value->it_value.tv_usec;
3133f0a525eSXiao Guangrong 		__entry->interval_sec	= value->it_interval.tv_sec;
3143f0a525eSXiao Guangrong 		__entry->interval_usec	= value->it_interval.tv_usec;
3153f0a525eSXiao Guangrong 	),
3163f0a525eSXiao Guangrong 
317e9c0748bSThomas Gleixner 	TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
318858cf3a8SFrederic Weisbecker 		  __entry->which, __entry->expires,
3193f0a525eSXiao Guangrong 		  __entry->value_sec, __entry->value_usec,
3203f0a525eSXiao Guangrong 		  __entry->interval_sec, __entry->interval_usec)
3213f0a525eSXiao Guangrong );
3223f0a525eSXiao Guangrong 
3233f0a525eSXiao Guangrong /**
3243f0a525eSXiao Guangrong  * itimer_expire - called when itimer expires
3253f0a525eSXiao Guangrong  * @which:	type of the interval timer
3263f0a525eSXiao Guangrong  * @pid:	pid of the process which owns the timer
3273f0a525eSXiao Guangrong  * @now:	current time, used to calculate the latency of itimer
3283f0a525eSXiao Guangrong  */
3293f0a525eSXiao Guangrong TRACE_EVENT(itimer_expire,
3303f0a525eSXiao Guangrong 
331858cf3a8SFrederic Weisbecker 	TP_PROTO(int which, struct pid *pid, unsigned long long now),
3323f0a525eSXiao Guangrong 
3333f0a525eSXiao Guangrong 	TP_ARGS(which, pid, now),
3343f0a525eSXiao Guangrong 
3353f0a525eSXiao Guangrong 	TP_STRUCT__entry(
3363f0a525eSXiao Guangrong 		__field( int ,			which	)
3373f0a525eSXiao Guangrong 		__field( pid_t,			pid	)
338858cf3a8SFrederic Weisbecker 		__field( unsigned long long,	now	)
3393f0a525eSXiao Guangrong 	),
3403f0a525eSXiao Guangrong 
3413f0a525eSXiao Guangrong 	TP_fast_assign(
3423f0a525eSXiao Guangrong 		__entry->which	= which;
3433f0a525eSXiao Guangrong 		__entry->now	= now;
3443f0a525eSXiao Guangrong 		__entry->pid	= pid_nr(pid);
3453f0a525eSXiao Guangrong 	),
3463f0a525eSXiao Guangrong 
347e9c0748bSThomas Gleixner 	TP_printk("which=%d pid=%d now=%llu", __entry->which,
348858cf3a8SFrederic Weisbecker 		  (int) __entry->pid, __entry->now)
3493f0a525eSXiao Guangrong );
3503f0a525eSXiao Guangrong 
3512c82d1beSFrederic Weisbecker #ifdef CONFIG_NO_HZ_COMMON
352e6e6cc22SFrederic Weisbecker 
353e6e6cc22SFrederic Weisbecker #define TICK_DEP_NAMES					\
354c87edb36SSteven Rostedt (Red Hat) 		tick_dep_mask_name(NONE)		\
355e6e6cc22SFrederic Weisbecker 		tick_dep_name(POSIX_TIMER)		\
356e6e6cc22SFrederic Weisbecker 		tick_dep_name(PERF_EVENTS)		\
357e6e6cc22SFrederic Weisbecker 		tick_dep_name(SCHED)			\
358e6e6cc22SFrederic Weisbecker 		tick_dep_name_end(CLOCK_UNSTABLE)
359e6e6cc22SFrederic Weisbecker 
360e6e6cc22SFrederic Weisbecker #undef tick_dep_name
361c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_mask_name
362e6e6cc22SFrederic Weisbecker #undef tick_dep_name_end
363e6e6cc22SFrederic Weisbecker 
364c87edb36SSteven Rostedt (Red Hat) /* The MASK will convert to their bits and they need to be processed too */
365c87edb36SSteven Rostedt (Red Hat) #define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
366c87edb36SSteven Rostedt (Red Hat) 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
367c87edb36SSteven Rostedt (Red Hat) #define tick_dep_name_end(sdep)  TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
368c87edb36SSteven Rostedt (Red Hat) 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
369c87edb36SSteven Rostedt (Red Hat) /* NONE only has a mask defined for it */
370c87edb36SSteven Rostedt (Red Hat) #define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
371e6e6cc22SFrederic Weisbecker 
372e6e6cc22SFrederic Weisbecker TICK_DEP_NAMES
373e6e6cc22SFrederic Weisbecker 
374e6e6cc22SFrederic Weisbecker #undef tick_dep_name
375c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_mask_name
376e6e6cc22SFrederic Weisbecker #undef tick_dep_name_end
377e6e6cc22SFrederic Weisbecker 
378e6e6cc22SFrederic Weisbecker #define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
379c87edb36SSteven Rostedt (Red Hat) #define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
380e6e6cc22SFrederic Weisbecker #define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep }
381e6e6cc22SFrederic Weisbecker 
382e6e6cc22SFrederic Weisbecker #define show_tick_dep_name(val)				\
383e6e6cc22SFrederic Weisbecker 	__print_symbolic(val, TICK_DEP_NAMES)
384e6e6cc22SFrederic Weisbecker 
385cb41a290SFrederic Weisbecker TRACE_EVENT(tick_stop,
386cb41a290SFrederic Weisbecker 
387e6e6cc22SFrederic Weisbecker 	TP_PROTO(int success, int dependency),
388cb41a290SFrederic Weisbecker 
389e6e6cc22SFrederic Weisbecker 	TP_ARGS(success, dependency),
390cb41a290SFrederic Weisbecker 
391cb41a290SFrederic Weisbecker 	TP_STRUCT__entry(
392cb41a290SFrederic Weisbecker 		__field( int ,		success	)
393e6e6cc22SFrederic Weisbecker 		__field( int ,		dependency )
394cb41a290SFrederic Weisbecker 	),
395cb41a290SFrederic Weisbecker 
396cb41a290SFrederic Weisbecker 	TP_fast_assign(
397cb41a290SFrederic Weisbecker 		__entry->success	= success;
398e6e6cc22SFrederic Weisbecker 		__entry->dependency	= dependency;
399cb41a290SFrederic Weisbecker 	),
400cb41a290SFrederic Weisbecker 
401e6e6cc22SFrederic Weisbecker 	TP_printk("success=%d dependency=%s",  __entry->success, \
402e6e6cc22SFrederic Weisbecker 			show_tick_dep_name(__entry->dependency))
403cb41a290SFrederic Weisbecker );
404cb41a290SFrederic Weisbecker #endif
405cb41a290SFrederic Weisbecker 
4062b022e3dSXiao Guangrong #endif /*  _TRACE_TIMER_H */
4072b022e3dSXiao Guangrong 
4082b022e3dSXiao Guangrong /* This part must be outside protection */
4092b022e3dSXiao Guangrong #include <trace/define_trace.h>
410