Li Zefan | d0b6e04 | 2009-07-13 10:33:21 +0800 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
Frederic Weisbecker | 6717876 | 2009-11-13 10:06:34 +0100 | [diff] [blame] | 2 | #define TRACE_SYSTEM lock |
Li Zefan | d0b6e04 | 2009-07-13 10:33:21 +0800 | [diff] [blame] | 3 | |
Frederic Weisbecker | 6717876 | 2009-11-13 10:06:34 +0100 | [diff] [blame] | 4 | #if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_LOCK_H |
Peter Zijlstra | efed792 | 2009-03-04 12:32:55 +0100 | [diff] [blame] | 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) |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame] | 23 | __field(void *, lockdep_addr) |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 24 | ), |
| 25 | |
| 26 | TP_fast_assign( |
| 27 | __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0); |
| 28 | __assign_str(name, lock->name); |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame] | 29 | __entry->lockdep_addr = lock; |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 30 | ), |
| 31 | |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame] | 32 | TP_printk("%p %s%s%s", __entry->lockdep_addr, |
| 33 | (__entry->flags & 1) ? "try " : "", |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 34 | (__entry->flags & 2) ? "read " : "", |
| 35 | __get_str(name)) |
| 36 | ); |
| 37 | |
Frederic Weisbecker | 2c193c7 | 2010-05-08 06:36:02 +0200 | [diff] [blame] | 38 | DECLARE_EVENT_CLASS(lock, |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 39 | |
Frederic Weisbecker | 9313543 | 2010-05-08 06:24:25 +0200 | [diff] [blame] | 40 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 41 | |
Frederic Weisbecker | 9313543 | 2010-05-08 06:24:25 +0200 | [diff] [blame] | 42 | TP_ARGS(lock, ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 43 | |
| 44 | TP_STRUCT__entry( |
Frederic Weisbecker | 2c193c7 | 2010-05-08 06:36:02 +0200 | [diff] [blame] | 45 | __string( name, lock->name ) |
| 46 | __field( void *, lockdep_addr ) |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 47 | ), |
| 48 | |
| 49 | TP_fast_assign( |
| 50 | __assign_str(name, lock->name); |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame] | 51 | __entry->lockdep_addr = lock; |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 52 | ), |
| 53 | |
Frederic Weisbecker | 2c193c7 | 2010-05-08 06:36:02 +0200 | [diff] [blame] | 54 | TP_printk("%p %s", __entry->lockdep_addr, __get_str(name)) |
| 55 | ); |
| 56 | |
| 57 | DEFINE_EVENT(lock, lock_release, |
| 58 | |
| 59 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
| 60 | |
| 61 | TP_ARGS(lock, ip) |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 62 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 63 | |
| 64 | #ifdef CONFIG_LOCK_STAT |
| 65 | |
Frederic Weisbecker | 2c193c7 | 2010-05-08 06:36:02 +0200 | [diff] [blame] | 66 | DEFINE_EVENT(lock, lock_contended, |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 67 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 68 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 69 | |
Frederic Weisbecker | 2c193c7 | 2010-05-08 06:36:02 +0200 | [diff] [blame] | 70 | TP_ARGS(lock, ip) |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 71 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 72 | |
Frederic Weisbecker | 2c193c7 | 2010-05-08 06:36:02 +0200 | [diff] [blame] | 73 | DEFINE_EVENT(lock, lock_acquired, |
| 74 | |
Frederic Weisbecker | 883a2a3 | 2010-05-08 06:16:11 +0200 | [diff] [blame] | 75 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 76 | |
Frederic Weisbecker | 2c193c7 | 2010-05-08 06:36:02 +0200 | [diff] [blame] | 77 | TP_ARGS(lock, ip) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 78 | ); |
Peter Zijlstra | efed792 | 2009-03-04 12:32:55 +0100 | [diff] [blame] | 79 | |
| 80 | #endif |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 81 | #endif |
| 82 | |
Frederic Weisbecker | 6717876 | 2009-11-13 10:06:34 +0100 | [diff] [blame] | 83 | #endif /* _TRACE_LOCK_H */ |
Steven Rostedt | a8d154b | 2009-04-10 09:36:00 -0400 | [diff] [blame] | 84 | |
| 85 | /* This part must be outside protection */ |
| 86 | #include <trace/define_trace.h> |