From f3f909f4c73fa115c5bab66b2ba2caa7ad2d8bf2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 16 Jul 2015 13:02:44 -0400 Subject: [PATCH] Fix: timer instrumentation for 4.2 kernels Signed-off-by: Mathieu Desnoyers --- instrumentation/events/lttng-module/timer.h | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/instrumentation/events/lttng-module/timer.h b/instrumentation/events/lttng-module/timer.h index 8bd67e50..f6369c04 100644 --- a/instrumentation/events/lttng-module/timer.h +++ b/instrumentation/events/lttng-module/timer.h @@ -10,6 +10,7 @@ #define _TRACE_TIMER_DEF_ #include #include +#include struct timer_list; @@ -43,6 +44,39 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(timer_class, timer_init, TP_ARGS(timer) ) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) +/** + * timer_start - called when the timer is started + * @timer: pointer to struct timer_list + * @expires: the timers expiry time + * @flags: the timers expiry time + */ +LTTNG_TRACEPOINT_EVENT(timer_start, + + TP_PROTO(struct timer_list *timer, unsigned long expires, + unsigned int flags), + + TP_ARGS(timer, expires, flags), + + TP_STRUCT__entry( + __field( void *, timer ) + __field( void *, function ) + __field( unsigned long, expires ) + __field( unsigned long, now ) + __field( unsigned int, flags ) + ), + + TP_fast_assign( + tp_assign(timer, timer) + tp_assign(function, timer->function) + tp_assign(expires, expires) + tp_assign(now, jiffies) + tp_assign(flags, flags) + ), + + TP_printk() +) +#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */ /** * timer_start - called when the timer is started * @timer: pointer to struct timer_list @@ -72,6 +106,7 @@ LTTNG_TRACEPOINT_EVENT(timer_start, __entry->timer, __entry->function, __entry->expires, (long)__entry->expires - __entry->now) ) +#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */ /** * timer_expire_entry - called immediately before the timer callback -- 2.34.1