xref: /openbmc/linux/include/trace/events/timer.h (revision 98ecadd4305d8677ba77162152485798d47dcc85)
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 
13991633eedSAnna-Maria Gleixner #define decode_clockid(type)						\
14091633eedSAnna-Maria Gleixner 	__print_symbolic(type,						\
14191633eedSAnna-Maria Gleixner 		{ CLOCK_REALTIME,	"CLOCK_REALTIME"	},	\
14291633eedSAnna-Maria Gleixner 		{ CLOCK_MONOTONIC,	"CLOCK_MONOTONIC"	},	\
14391633eedSAnna-Maria Gleixner 		{ CLOCK_BOOTTIME,	"CLOCK_BOOTTIME"	},	\
14491633eedSAnna-Maria Gleixner 		{ CLOCK_TAI,		"CLOCK_TAI"		})
14591633eedSAnna-Maria Gleixner 
14691633eedSAnna-Maria Gleixner #define decode_hrtimer_mode(mode)					\
14791633eedSAnna-Maria Gleixner 	__print_symbolic(mode,						\
14891633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS,		"ABS"		},	\
14991633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_REL,		"REL"		},	\
15091633eedSAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_PINNED,	"ABS|PINNED"	},	\
151*98ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_REL_PINNED,	"REL|PINNED"	},	\
152*98ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_SOFT,	"ABS|SOFT"	},	\
153*98ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_REL_SOFT,	"REL|SOFT"	},	\
154*98ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_ABS_PINNED_SOFT,	"ABS|PINNED|SOFT" },	\
155*98ecadd4SAnna-Maria Gleixner 		{ HRTIMER_MODE_REL_PINNED_SOFT,	"REL|PINNED|SOFT" })
15691633eedSAnna-Maria Gleixner 
157c6a2a177SXiao Guangrong /**
158c6a2a177SXiao Guangrong  * hrtimer_init - called when the hrtimer is initialized
159cf2fbdd2SMasanari Iida  * @hrtimer:	pointer to struct hrtimer
160c6a2a177SXiao Guangrong  * @clockid:	the hrtimers clock
161c6a2a177SXiao Guangrong  * @mode:	the hrtimers mode
162c6a2a177SXiao Guangrong  */
163c6a2a177SXiao Guangrong TRACE_EVENT(hrtimer_init,
164c6a2a177SXiao Guangrong 
165434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
166c6a2a177SXiao Guangrong 		 enum hrtimer_mode mode),
167c6a2a177SXiao Guangrong 
168434a83c3SIngo Molnar 	TP_ARGS(hrtimer, clockid, mode),
169c6a2a177SXiao Guangrong 
170c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
171434a83c3SIngo Molnar 		__field( void *,		hrtimer		)
172c6a2a177SXiao Guangrong 		__field( clockid_t,		clockid		)
173c6a2a177SXiao Guangrong 		__field( enum hrtimer_mode,	mode		)
174c6a2a177SXiao Guangrong 	),
175c6a2a177SXiao Guangrong 
176c6a2a177SXiao Guangrong 	TP_fast_assign(
177434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
178c6a2a177SXiao Guangrong 		__entry->clockid	= clockid;
179c6a2a177SXiao Guangrong 		__entry->mode		= mode;
180c6a2a177SXiao Guangrong 	),
181c6a2a177SXiao Guangrong 
182434a83c3SIngo Molnar 	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
18391633eedSAnna-Maria Gleixner 		  decode_clockid(__entry->clockid),
18491633eedSAnna-Maria Gleixner 		  decode_hrtimer_mode(__entry->mode))
185c6a2a177SXiao Guangrong );
186c6a2a177SXiao Guangrong 
187c6a2a177SXiao Guangrong /**
188c6a2a177SXiao Guangrong  * hrtimer_start - called when the hrtimer is started
189cf2fbdd2SMasanari Iida  * @hrtimer: pointer to struct hrtimer
190c6a2a177SXiao Guangrong  */
191c6a2a177SXiao Guangrong TRACE_EVENT(hrtimer_start,
192c6a2a177SXiao Guangrong 
19363e2ed36SAnna-Maria Gleixner 	TP_PROTO(struct hrtimer *hrtimer, enum hrtimer_mode mode),
194c6a2a177SXiao Guangrong 
19563e2ed36SAnna-Maria Gleixner 	TP_ARGS(hrtimer, mode),
196c6a2a177SXiao Guangrong 
197c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
198434a83c3SIngo Molnar 		__field( void *,	hrtimer		)
199c6a2a177SXiao Guangrong 		__field( void *,	function	)
200c6a2a177SXiao Guangrong 		__field( s64,		expires		)
201c6a2a177SXiao Guangrong 		__field( s64,		softexpires	)
20263e2ed36SAnna-Maria Gleixner 		__field( enum hrtimer_mode,	mode	)
203c6a2a177SXiao Guangrong 	),
204c6a2a177SXiao Guangrong 
205c6a2a177SXiao Guangrong 	TP_fast_assign(
206434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
207434a83c3SIngo Molnar 		__entry->function	= hrtimer->function;
2082456e855SThomas Gleixner 		__entry->expires	= hrtimer_get_expires(hrtimer);
2092456e855SThomas Gleixner 		__entry->softexpires	= hrtimer_get_softexpires(hrtimer);
21063e2ed36SAnna-Maria Gleixner 		__entry->mode		= mode;
211c6a2a177SXiao Guangrong 	),
212c6a2a177SXiao Guangrong 
21363e2ed36SAnna-Maria Gleixner 	TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu "
21463e2ed36SAnna-Maria Gleixner 		  "mode=%s", __entry->hrtimer, __entry->function,
2152456e855SThomas Gleixner 		  (unsigned long long) __entry->expires,
21663e2ed36SAnna-Maria Gleixner 		  (unsigned long long) __entry->softexpires,
21763e2ed36SAnna-Maria Gleixner 		  decode_hrtimer_mode(__entry->mode))
218c6a2a177SXiao Guangrong );
219c6a2a177SXiao Guangrong 
220c6a2a177SXiao Guangrong /**
221cf2fbdd2SMasanari Iida  * hrtimer_expire_entry - called immediately before the hrtimer callback
222cf2fbdd2SMasanari Iida  * @hrtimer:	pointer to struct hrtimer
223c6a2a177SXiao Guangrong  * @now:	pointer to variable which contains current time of the
224c6a2a177SXiao Guangrong  *		timers base.
225c6a2a177SXiao Guangrong  *
226c6a2a177SXiao Guangrong  * Allows to determine the timer latency.
227c6a2a177SXiao Guangrong  */
228c6a2a177SXiao Guangrong TRACE_EVENT(hrtimer_expire_entry,
229c6a2a177SXiao Guangrong 
230434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
231c6a2a177SXiao Guangrong 
232434a83c3SIngo Molnar 	TP_ARGS(hrtimer, now),
233c6a2a177SXiao Guangrong 
234c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
235434a83c3SIngo Molnar 		__field( void *,	hrtimer	)
236c6a2a177SXiao Guangrong 		__field( s64,		now	)
237ede1b429SArjan van de Ven 		__field( void *,	function)
238c6a2a177SXiao Guangrong 	),
239c6a2a177SXiao Guangrong 
240c6a2a177SXiao Guangrong 	TP_fast_assign(
241434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
2422456e855SThomas Gleixner 		__entry->now		= *now;
243ede1b429SArjan van de Ven 		__entry->function	= hrtimer->function;
244c6a2a177SXiao Guangrong 	),
245c6a2a177SXiao Guangrong 
246ede1b429SArjan van de Ven 	TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function,
2472456e855SThomas Gleixner 		  (unsigned long long) __entry->now)
248c6a2a177SXiao Guangrong );
249c6a2a177SXiao Guangrong 
250363d0f64SLi Zefan DECLARE_EVENT_CLASS(hrtimer_class,
251c6a2a177SXiao Guangrong 
252434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer),
253c6a2a177SXiao Guangrong 
254434a83c3SIngo Molnar 	TP_ARGS(hrtimer),
255c6a2a177SXiao Guangrong 
256c6a2a177SXiao Guangrong 	TP_STRUCT__entry(
257434a83c3SIngo Molnar 		__field( void *,	hrtimer	)
258c6a2a177SXiao Guangrong 	),
259c6a2a177SXiao Guangrong 
260c6a2a177SXiao Guangrong 	TP_fast_assign(
261434a83c3SIngo Molnar 		__entry->hrtimer	= hrtimer;
262c6a2a177SXiao Guangrong 	),
263c6a2a177SXiao Guangrong 
264434a83c3SIngo Molnar 	TP_printk("hrtimer=%p", __entry->hrtimer)
265c6a2a177SXiao Guangrong );
266c6a2a177SXiao Guangrong 
267c6a2a177SXiao Guangrong /**
268363d0f64SLi Zefan  * hrtimer_expire_exit - called immediately after the hrtimer callback returns
269cf2fbdd2SMasanari Iida  * @hrtimer:	pointer to struct hrtimer
270363d0f64SLi Zefan  *
271363d0f64SLi Zefan  * When used in combination with the hrtimer_expire_entry tracepoint we can
272363d0f64SLi Zefan  * determine the runtime of the callback function.
273c6a2a177SXiao Guangrong  */
274363d0f64SLi Zefan DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit,
275c6a2a177SXiao Guangrong 
276434a83c3SIngo Molnar 	TP_PROTO(struct hrtimer *hrtimer),
277c6a2a177SXiao Guangrong 
278363d0f64SLi Zefan 	TP_ARGS(hrtimer)
279363d0f64SLi Zefan );
280c6a2a177SXiao Guangrong 
281363d0f64SLi Zefan /**
282363d0f64SLi Zefan  * hrtimer_cancel - called when the hrtimer is canceled
283363d0f64SLi Zefan  * @hrtimer:	pointer to struct hrtimer
284363d0f64SLi Zefan  */
285363d0f64SLi Zefan DEFINE_EVENT(hrtimer_class, hrtimer_cancel,
286c6a2a177SXiao Guangrong 
287363d0f64SLi Zefan 	TP_PROTO(struct hrtimer *hrtimer),
288c6a2a177SXiao Guangrong 
289363d0f64SLi Zefan 	TP_ARGS(hrtimer)
290c6a2a177SXiao Guangrong );
291c6a2a177SXiao Guangrong 
2923f0a525eSXiao Guangrong /**
2933f0a525eSXiao Guangrong  * itimer_state - called when itimer is started or canceled
2943f0a525eSXiao Guangrong  * @which:	name of the interval timer
2953f0a525eSXiao Guangrong  * @value:	the itimers value, itimer is canceled if value->it_value is
2963f0a525eSXiao Guangrong  *		zero, otherwise it is started
2973f0a525eSXiao Guangrong  * @expires:	the itimers expiry time
2983f0a525eSXiao Guangrong  */
2993f0a525eSXiao Guangrong TRACE_EVENT(itimer_state,
3003f0a525eSXiao Guangrong 
3013f0a525eSXiao Guangrong 	TP_PROTO(int which, const struct itimerval *const value,
302858cf3a8SFrederic Weisbecker 		 unsigned long long expires),
3033f0a525eSXiao Guangrong 
3043f0a525eSXiao Guangrong 	TP_ARGS(which, value, expires),
3053f0a525eSXiao Guangrong 
3063f0a525eSXiao Guangrong 	TP_STRUCT__entry(
3073f0a525eSXiao Guangrong 		__field(	int,			which		)
308858cf3a8SFrederic Weisbecker 		__field(	unsigned long long,	expires		)
3093f0a525eSXiao Guangrong 		__field(	long,			value_sec	)
3103f0a525eSXiao Guangrong 		__field(	long,			value_usec	)
3113f0a525eSXiao Guangrong 		__field(	long,			interval_sec	)
3123f0a525eSXiao Guangrong 		__field(	long,			interval_usec	)
3133f0a525eSXiao Guangrong 	),
3143f0a525eSXiao Guangrong 
3153f0a525eSXiao Guangrong 	TP_fast_assign(
3163f0a525eSXiao Guangrong 		__entry->which		= which;
3173f0a525eSXiao Guangrong 		__entry->expires	= expires;
3183f0a525eSXiao Guangrong 		__entry->value_sec	= value->it_value.tv_sec;
3193f0a525eSXiao Guangrong 		__entry->value_usec	= value->it_value.tv_usec;
3203f0a525eSXiao Guangrong 		__entry->interval_sec	= value->it_interval.tv_sec;
3213f0a525eSXiao Guangrong 		__entry->interval_usec	= value->it_interval.tv_usec;
3223f0a525eSXiao Guangrong 	),
3233f0a525eSXiao Guangrong 
324e9c0748bSThomas Gleixner 	TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
325858cf3a8SFrederic Weisbecker 		  __entry->which, __entry->expires,
3263f0a525eSXiao Guangrong 		  __entry->value_sec, __entry->value_usec,
3273f0a525eSXiao Guangrong 		  __entry->interval_sec, __entry->interval_usec)
3283f0a525eSXiao Guangrong );
3293f0a525eSXiao Guangrong 
3303f0a525eSXiao Guangrong /**
3313f0a525eSXiao Guangrong  * itimer_expire - called when itimer expires
3323f0a525eSXiao Guangrong  * @which:	type of the interval timer
3333f0a525eSXiao Guangrong  * @pid:	pid of the process which owns the timer
3343f0a525eSXiao Guangrong  * @now:	current time, used to calculate the latency of itimer
3353f0a525eSXiao Guangrong  */
3363f0a525eSXiao Guangrong TRACE_EVENT(itimer_expire,
3373f0a525eSXiao Guangrong 
338858cf3a8SFrederic Weisbecker 	TP_PROTO(int which, struct pid *pid, unsigned long long now),
3393f0a525eSXiao Guangrong 
3403f0a525eSXiao Guangrong 	TP_ARGS(which, pid, now),
3413f0a525eSXiao Guangrong 
3423f0a525eSXiao Guangrong 	TP_STRUCT__entry(
3433f0a525eSXiao Guangrong 		__field( int ,			which	)
3443f0a525eSXiao Guangrong 		__field( pid_t,			pid	)
345858cf3a8SFrederic Weisbecker 		__field( unsigned long long,	now	)
3463f0a525eSXiao Guangrong 	),
3473f0a525eSXiao Guangrong 
3483f0a525eSXiao Guangrong 	TP_fast_assign(
3493f0a525eSXiao Guangrong 		__entry->which	= which;
3503f0a525eSXiao Guangrong 		__entry->now	= now;
3513f0a525eSXiao Guangrong 		__entry->pid	= pid_nr(pid);
3523f0a525eSXiao Guangrong 	),
3533f0a525eSXiao Guangrong 
354e9c0748bSThomas Gleixner 	TP_printk("which=%d pid=%d now=%llu", __entry->which,
355858cf3a8SFrederic Weisbecker 		  (int) __entry->pid, __entry->now)
3563f0a525eSXiao Guangrong );
3573f0a525eSXiao Guangrong 
3582c82d1beSFrederic Weisbecker #ifdef CONFIG_NO_HZ_COMMON
359e6e6cc22SFrederic Weisbecker 
360e6e6cc22SFrederic Weisbecker #define TICK_DEP_NAMES					\
361c87edb36SSteven Rostedt (Red Hat) 		tick_dep_mask_name(NONE)		\
362e6e6cc22SFrederic Weisbecker 		tick_dep_name(POSIX_TIMER)		\
363e6e6cc22SFrederic Weisbecker 		tick_dep_name(PERF_EVENTS)		\
364e6e6cc22SFrederic Weisbecker 		tick_dep_name(SCHED)			\
365e6e6cc22SFrederic Weisbecker 		tick_dep_name_end(CLOCK_UNSTABLE)
366e6e6cc22SFrederic Weisbecker 
367e6e6cc22SFrederic Weisbecker #undef tick_dep_name
368c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_mask_name
369e6e6cc22SFrederic Weisbecker #undef tick_dep_name_end
370e6e6cc22SFrederic Weisbecker 
371c87edb36SSteven Rostedt (Red Hat) /* The MASK will convert to their bits and they need to be processed too */
372c87edb36SSteven Rostedt (Red Hat) #define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
373c87edb36SSteven Rostedt (Red Hat) 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
374c87edb36SSteven Rostedt (Red Hat) #define tick_dep_name_end(sdep)  TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
375c87edb36SSteven Rostedt (Red Hat) 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
376c87edb36SSteven Rostedt (Red Hat) /* NONE only has a mask defined for it */
377c87edb36SSteven Rostedt (Red Hat) #define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
378e6e6cc22SFrederic Weisbecker 
379e6e6cc22SFrederic Weisbecker TICK_DEP_NAMES
380e6e6cc22SFrederic Weisbecker 
381e6e6cc22SFrederic Weisbecker #undef tick_dep_name
382c87edb36SSteven Rostedt (Red Hat) #undef tick_dep_mask_name
383e6e6cc22SFrederic Weisbecker #undef tick_dep_name_end
384e6e6cc22SFrederic Weisbecker 
385e6e6cc22SFrederic Weisbecker #define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
386c87edb36SSteven Rostedt (Red Hat) #define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
387e6e6cc22SFrederic Weisbecker #define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep }
388e6e6cc22SFrederic Weisbecker 
389e6e6cc22SFrederic Weisbecker #define show_tick_dep_name(val)				\
390e6e6cc22SFrederic Weisbecker 	__print_symbolic(val, TICK_DEP_NAMES)
391e6e6cc22SFrederic Weisbecker 
392cb41a290SFrederic Weisbecker TRACE_EVENT(tick_stop,
393cb41a290SFrederic Weisbecker 
394e6e6cc22SFrederic Weisbecker 	TP_PROTO(int success, int dependency),
395cb41a290SFrederic Weisbecker 
396e6e6cc22SFrederic Weisbecker 	TP_ARGS(success, dependency),
397cb41a290SFrederic Weisbecker 
398cb41a290SFrederic Weisbecker 	TP_STRUCT__entry(
399cb41a290SFrederic Weisbecker 		__field( int ,		success	)
400e6e6cc22SFrederic Weisbecker 		__field( int ,		dependency )
401cb41a290SFrederic Weisbecker 	),
402cb41a290SFrederic Weisbecker 
403cb41a290SFrederic Weisbecker 	TP_fast_assign(
404cb41a290SFrederic Weisbecker 		__entry->success	= success;
405e6e6cc22SFrederic Weisbecker 		__entry->dependency	= dependency;
406cb41a290SFrederic Weisbecker 	),
407cb41a290SFrederic Weisbecker 
408e6e6cc22SFrederic Weisbecker 	TP_printk("success=%d dependency=%s",  __entry->success, \
409e6e6cc22SFrederic Weisbecker 			show_tick_dep_name(__entry->dependency))
410cb41a290SFrederic Weisbecker );
411cb41a290SFrederic Weisbecker #endif
412cb41a290SFrederic Weisbecker 
4132b022e3dSXiao Guangrong #endif /*  _TRACE_TIMER_H */
4142b022e3dSXiao Guangrong 
4152b022e3dSXiao Guangrong /* This part must be outside protection */
4162b022e3dSXiao Guangrong #include <trace/define_trace.h>
417