X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Flock.h;h=ff7f7eeda99888b8b24555959a2fb9030061bb32;hb=e98cea77da6a2f4011a072fac3f0437ac3fb1a97;hp=e2c1c7a4a310792f5f687784a6da06b2a6e7e571;hpb=d3ac4d63d21c643df5b09d9d7888eb0c4122379c;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/lock.h b/instrumentation/events/lttng-module/lock.h index e2c1c7a4..ff7f7eed 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 #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_hex(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_hex(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_hex(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_hex(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_hex(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" +#include