X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Flock.h;h=3e5d68a56f1c4cd55b48c7071de903ba99c09a62;hb=f127e61ee231d002fb9a7803643a157e06f6d2e2;hp=75101f69e22972404ea5cbe23af6c7d7ea6a7391;hpb=b283666ff19841a28b0448c6a867beb2f809f11a;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/lock.h b/instrumentation/events/lttng-module/lock.h index 75101f69..3e5d68a5 100644 --- a/instrumentation/events/lttng-module/lock.h +++ b/instrumentation/events/lttng-module/lock.h @@ -1,15 +1,25 @@ +#include + #undef TRACE_SYSTEM +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) #define TRACE_SYSTEM lock +#else +#define TRACE_SYSTEM lockdep +#define TRACE_INCLUDE_FILE lock +#if defined(_TRACE_LOCKDEP_H) +#define LTTNG_TRACE_LOCK_H +#endif +#endif -#if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_LOCK_H +#if !defined(LTTNG_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ) +#define LTTNG_TRACE_LOCK_H #include -#include +#include "../../../probes/lttng-tracepoint-event.h" #ifdef CONFIG_LOCKDEP -TRACE_EVENT(lock_acquire, +LTTNG_TRACEPOINT_EVENT(lock_acquire, TP_PROTO(struct lockdep_map *lock, unsigned int subclass, int trylock, int read, int check, @@ -17,44 +27,30 @@ TRACE_EVENT(lock_acquire, TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip), - TP_STRUCT__entry( - __field(unsigned int, flags) - __string(name, lock->name) - __field(void *, lockdep_addr) - ), - - TP_fast_assign( - tp_assign(flags, (trylock ? 1 : 0) | (read ? 2 : 0)); - tp_strcpy(name, lock->name); - tp_assign(lockdep_addr, lock); - ), - - TP_printk("%p %s%s%s", __entry->lockdep_addr, - (__entry->flags & 1) ? "try " : "", - (__entry->flags & 2) ? "read " : "", - __get_str(name)) + TP_FIELDS( + ctf_integer(unsigned int, flags, (trylock ? 1 : 0) | (read ? 2 : 0)) + ctf_string(name, lock->name) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) + ctf_integer(void *, lockdep_addr, lock) +#endif + ) ) -DECLARE_EVENT_CLASS(lock, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + +LTTNG_TRACEPOINT_EVENT_CLASS(lock, TP_PROTO(struct lockdep_map *lock, unsigned long ip), TP_ARGS(lock, ip), - TP_STRUCT__entry( - __string( name, lock->name ) - __field( void *, lockdep_addr ) - ), - - TP_fast_assign( - tp_strcpy(name, lock->name); - tp_assign(lockdep_addr, lock); - ), - - TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) + TP_FIELDS( + ctf_string(name, lock->name) + ctf_integer(void *, lockdep_addr, lock) + ) ) -DEFINE_EVENT(lock, lock_release, +LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_release, TP_PROTO(struct lockdep_map *lock, unsigned long ip), @@ -63,14 +59,14 @@ DEFINE_EVENT(lock, lock_release, #ifdef CONFIG_LOCK_STAT -DEFINE_EVENT(lock, lock_contended, +LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_contended, TP_PROTO(struct lockdep_map *lock, unsigned long ip), TP_ARGS(lock, ip) ) -DEFINE_EVENT(lock, lock_acquired, +LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_acquired, TP_PROTO(struct lockdep_map *lock, unsigned long ip), @@ -78,9 +74,64 @@ DEFINE_EVENT(lock, lock_acquired, ) #endif + +#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */ + +LTTNG_TRACEPOINT_EVENT(lock_release, + + TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), + + TP_ARGS(lock, nested, ip), + + TP_FIELDS( + ctf_string(name, lock->name) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) + ctf_integer(void *, lockdep_addr, lock) +#endif + ) +) + +#ifdef CONFIG_LOCK_STAT + +LTTNG_TRACEPOINT_EVENT(lock_contended, + + TP_PROTO(struct lockdep_map *lock, unsigned long ip), + + TP_ARGS(lock, ip), + + TP_FIELDS( + ctf_string(name, lock->name) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) + ctf_integer(void *, lockdep_addr, lock) +#endif + ) +) + +LTTNG_TRACEPOINT_EVENT(lock_acquired, + + TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), + + TP_ARGS(lock, ip, waittime), + + TP_FIELDS( + ctf_string(name, lock->name) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) + ctf_integer(s64, wait_nsec, wait_nsec) + ctf_integer(void *, lockdep_addr, lock) +#else + ctf_integer(unsigned long, wait_usec, (unsigned long) waittime) + ctf_integer(unsigned long, wait_nsec_rem, do_div(waittime, NSEC_PER_USEC)) +#endif + ) +) + +#endif + +#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */ + #endif -#endif /* _TRACE_LOCK_H */ +#endif /* LTTNG_TRACE_LOCK_H */ /* This part must be outside protection */ #include "../../../probes/define_trace.h"