Li Zefan | d0b6e04 | 2009-07-13 10:33:21 +0800 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM lockdep |
| 3 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 4 | #if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ) |
Peter Zijlstra | efed792 | 2009-03-04 12:32:55 +0100 | [diff] [blame] | 5 | #define _TRACE_LOCKDEP_H |
| 6 | |
| 7 | #include <linux/lockdep.h> |
| 8 | #include <linux/tracepoint.h> |
| 9 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 10 | #ifdef CONFIG_LOCKDEP |
| 11 | |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 12 | TRACE_EVENT(lock_acquire, |
| 13 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 14 | TP_PROTO(struct lockdep_map *lock, unsigned int subclass, |
| 15 | int trylock, int read, int check, |
| 16 | struct lockdep_map *next_lock, unsigned long ip), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 17 | |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 18 | TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip), |
| 19 | |
| 20 | TP_STRUCT__entry( |
| 21 | __field(unsigned int, flags) |
| 22 | __string(name, lock->name) |
| 23 | ), |
| 24 | |
| 25 | TP_fast_assign( |
| 26 | __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0); |
| 27 | __assign_str(name, lock->name); |
| 28 | ), |
| 29 | |
| 30 | TP_printk("%s%s%s", (__entry->flags & 1) ? "try " : "", |
| 31 | (__entry->flags & 2) ? "read " : "", |
| 32 | __get_str(name)) |
| 33 | ); |
| 34 | |
| 35 | TRACE_EVENT(lock_release, |
| 36 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 37 | TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 38 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 39 | TP_ARGS(lock, nested, ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 40 | |
| 41 | TP_STRUCT__entry( |
| 42 | __string(name, lock->name) |
| 43 | ), |
| 44 | |
| 45 | TP_fast_assign( |
| 46 | __assign_str(name, lock->name); |
| 47 | ), |
| 48 | |
| 49 | TP_printk("%s", __get_str(name)) |
| 50 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 51 | |
| 52 | #ifdef CONFIG_LOCK_STAT |
| 53 | |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 54 | TRACE_EVENT(lock_contended, |
| 55 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 56 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 57 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 58 | TP_ARGS(lock, ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 59 | |
| 60 | TP_STRUCT__entry( |
| 61 | __string(name, lock->name) |
| 62 | ), |
| 63 | |
| 64 | TP_fast_assign( |
| 65 | __assign_str(name, lock->name); |
| 66 | ), |
| 67 | |
| 68 | TP_printk("%s", __get_str(name)) |
| 69 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 70 | |
| 71 | TRACE_EVENT(lock_acquired, |
| 72 | TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), |
| 73 | |
| 74 | TP_ARGS(lock, ip, waittime), |
| 75 | |
| 76 | TP_STRUCT__entry( |
Frederic Weisbecker | 7e7ca9a | 2009-04-19 04:54:49 +0200 | [diff] [blame] | 77 | __string(name, lock->name) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 78 | __field(unsigned long, wait_usec) |
| 79 | __field(unsigned long, wait_nsec_rem) |
| 80 | ), |
| 81 | TP_fast_assign( |
Frederic Weisbecker | 7e7ca9a | 2009-04-19 04:54:49 +0200 | [diff] [blame] | 82 | __assign_str(name, lock->name); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 83 | __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC); |
| 84 | __entry->wait_usec = (unsigned long) waittime; |
| 85 | ), |
Frederic Weisbecker | 7e7ca9a | 2009-04-19 04:54:49 +0200 | [diff] [blame] | 86 | TP_printk("%s (%lu.%03lu us)", __get_str(name), __entry->wait_usec, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 87 | __entry->wait_nsec_rem) |
| 88 | ); |
Peter Zijlstra | efed792 | 2009-03-04 12:32:55 +0100 | [diff] [blame] | 89 | |
| 90 | #endif |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 91 | #endif |
| 92 | |
| 93 | #endif /* _TRACE_LOCKDEP_H */ |
Steven Rostedt | a8d154b | 2009-04-10 09:36:00 -0400 | [diff] [blame] | 94 | |
| 95 | /* This part must be outside protection */ |
| 96 | #include <trace/define_trace.h> |