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 | |
| 38 | TRACE_EVENT(lock_release, |
| 39 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 40 | TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 41 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 42 | TP_ARGS(lock, nested, ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 43 | |
| 44 | TP_STRUCT__entry( |
| 45 | __string(name, lock->name) |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 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 | |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 54 | TP_printk("%p %s", |
| 55 | __entry->lockdep_addr, __get_str(name)) |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 56 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 57 | |
| 58 | #ifdef CONFIG_LOCK_STAT |
| 59 | |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 60 | TRACE_EVENT(lock_contended, |
| 61 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 62 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 63 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 64 | TP_ARGS(lock, ip), |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 65 | |
| 66 | TP_STRUCT__entry( |
| 67 | __string(name, lock->name) |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 68 | __field(void *, lockdep_addr) |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 69 | ), |
| 70 | |
| 71 | TP_fast_assign( |
| 72 | __assign_str(name, lock->name); |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 73 | __entry->lockdep_addr = lock; |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 74 | ), |
| 75 | |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 76 | TP_printk("%p %s", |
| 77 | __entry->lockdep_addr, __get_str(name)) |
Steven Rostedt | 3951709 | 2009-04-24 11:05:52 -0400 | [diff] [blame] | 78 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 79 | |
| 80 | TRACE_EVENT(lock_acquired, |
| 81 | TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), |
| 82 | |
| 83 | TP_ARGS(lock, ip, waittime), |
| 84 | |
| 85 | TP_STRUCT__entry( |
Frederic Weisbecker | 7e7ca9a | 2009-04-19 04:54:49 +0200 | [diff] [blame] | 86 | __string(name, lock->name) |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 87 | __field(s64, wait_nsec) |
| 88 | __field(void *, lockdep_addr) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 89 | ), |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 90 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 91 | TP_fast_assign( |
Frederic Weisbecker | 7e7ca9a | 2009-04-19 04:54:49 +0200 | [diff] [blame] | 92 | __assign_str(name, lock->name); |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 93 | __entry->wait_nsec = waittime; |
| 94 | __entry->lockdep_addr = lock; |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 95 | ), |
Hitoshi Mitake | c965be1 | 2010-01-30 20:43:32 +0900 | [diff] [blame^] | 96 | TP_printk("%p %s (%llu ns)", __entry->lockdep_addr, |
| 97 | __get_str(name), |
| 98 | __entry->wait_nsec) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 99 | ); |
Peter Zijlstra | efed792 | 2009-03-04 12:32:55 +0100 | [diff] [blame] | 100 | |
| 101 | #endif |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 102 | #endif |
| 103 | |
Frederic Weisbecker | 6717876 | 2009-11-13 10:06:34 +0100 | [diff] [blame] | 104 | #endif /* _TRACE_LOCK_H */ |
Steven Rostedt | a8d154b | 2009-04-10 09:36:00 -0400 | [diff] [blame] | 105 | |
| 106 | /* This part must be outside protection */ |
| 107 | #include <trace/define_trace.h> |