Fix: timer instrumentation for 4.2 kernels
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 16 Jul 2015 17:02:44 +0000 (13:02 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 16 Jul 2015 17:07:31 +0000 (13:07 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/timer.h

index 8bd67e509bd7c394ca98627935bbfeb3737e14f4..f6369c04f492c92aa122f1cb95d07e528258d14c 100644 (file)
@@ -10,6 +10,7 @@
 #define _TRACE_TIMER_DEF_
 #include <linux/hrtimer.h>
 #include <linux/timer.h>
+#include <linux/version.h>
 
 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
This page took 0.026771 seconds and 4 git commands to generate.