Commit | Line | Data |
---|---|---|
7c68b363 AG |
1 | #include <linux/version.h> |
2 | ||
b283666f | 3 | #undef TRACE_SYSTEM |
7c68b363 | 4 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) |
b283666f | 5 | #define TRACE_SYSTEM lock |
7c68b363 AG |
6 | #else |
7 | #define TRACE_SYSTEM lockdep | |
8 | #define TRACE_INCLUDE_FILE lock | |
9 | #if defined(_TRACE_LOCKDEP_H) | |
3bc29f0a | 10 | #define LTTNG_TRACE_LOCK_H |
7c68b363 AG |
11 | #endif |
12 | #endif | |
b283666f | 13 | |
3bc29f0a MD |
14 | #if !defined(LTTNG_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ) |
15 | #define LTTNG_TRACE_LOCK_H | |
b283666f PW |
16 | |
17 | #include <linux/lockdep.h> | |
3bc29f0a | 18 | #include "../../../probes/lttng-tracepoint-event.h" |
b283666f PW |
19 | |
20 | #ifdef CONFIG_LOCKDEP | |
21 | ||
3bc29f0a | 22 | LTTNG_TRACEPOINT_EVENT(lock_acquire, |
b283666f PW |
23 | |
24 | TP_PROTO(struct lockdep_map *lock, unsigned int subclass, | |
25 | int trylock, int read, int check, | |
26 | struct lockdep_map *next_lock, unsigned long ip), | |
27 | ||
28 | TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip), | |
29 | ||
f127e61e MD |
30 | TP_FIELDS( |
31 | ctf_integer(unsigned int, flags, (trylock ? 1 : 0) | (read ? 2 : 0)) | |
32 | ctf_string(name, lock->name) | |
7c68b363 | 33 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) |
f127e61e | 34 | ctf_integer(void *, lockdep_addr, lock) |
7c68b363 | 35 | #endif |
f127e61e | 36 | ) |
b283666f PW |
37 | ) |
38 | ||
7c68b363 AG |
39 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) |
40 | ||
3bc29f0a | 41 | LTTNG_TRACEPOINT_EVENT_CLASS(lock, |
b283666f PW |
42 | |
43 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | |
44 | ||
45 | TP_ARGS(lock, ip), | |
46 | ||
f127e61e MD |
47 | TP_FIELDS( |
48 | ctf_string(name, lock->name) | |
49 | ctf_integer(void *, lockdep_addr, lock) | |
50 | ) | |
b283666f PW |
51 | ) |
52 | ||
3bc29f0a | 53 | LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_release, |
b283666f PW |
54 | |
55 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | |
56 | ||
57 | TP_ARGS(lock, ip) | |
58 | ) | |
59 | ||
60 | #ifdef CONFIG_LOCK_STAT | |
61 | ||
3bc29f0a | 62 | LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_contended, |
b283666f PW |
63 | |
64 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | |
65 | ||
66 | TP_ARGS(lock, ip) | |
67 | ) | |
68 | ||
3bc29f0a | 69 | LTTNG_TRACEPOINT_EVENT_INSTANCE(lock, lock_acquired, |
b283666f PW |
70 | |
71 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | |
72 | ||
73 | TP_ARGS(lock, ip) | |
74 | ) | |
75 | ||
76 | #endif | |
7c68b363 AG |
77 | |
78 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */ | |
79 | ||
3bc29f0a | 80 | LTTNG_TRACEPOINT_EVENT(lock_release, |
7c68b363 AG |
81 | |
82 | TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), | |
83 | ||
84 | TP_ARGS(lock, nested, ip), | |
85 | ||
f127e61e MD |
86 | TP_FIELDS( |
87 | ctf_string(name, lock->name) | |
7c68b363 | 88 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) |
f127e61e | 89 | ctf_integer(void *, lockdep_addr, lock) |
7c68b363 | 90 | #endif |
f127e61e | 91 | ) |
7c68b363 AG |
92 | ) |
93 | ||
94 | #ifdef CONFIG_LOCK_STAT | |
95 | ||
3bc29f0a | 96 | LTTNG_TRACEPOINT_EVENT(lock_contended, |
7c68b363 AG |
97 | |
98 | TP_PROTO(struct lockdep_map *lock, unsigned long ip), | |
99 | ||
100 | TP_ARGS(lock, ip), | |
101 | ||
f127e61e MD |
102 | TP_FIELDS( |
103 | ctf_string(name, lock->name) | |
7c68b363 | 104 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) |
f127e61e | 105 | ctf_integer(void *, lockdep_addr, lock) |
7c68b363 | 106 | #endif |
f127e61e | 107 | ) |
7c68b363 AG |
108 | ) |
109 | ||
3bc29f0a | 110 | LTTNG_TRACEPOINT_EVENT(lock_acquired, |
7c68b363 AG |
111 | |
112 | TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), | |
113 | ||
114 | TP_ARGS(lock, ip, waittime), | |
115 | ||
f127e61e MD |
116 | TP_FIELDS( |
117 | ctf_string(name, lock->name) | |
7c68b363 | 118 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) |
f127e61e MD |
119 | ctf_integer(s64, wait_nsec, wait_nsec) |
120 | ctf_integer(void *, lockdep_addr, lock) | |
7c68b363 | 121 | #else |
f127e61e MD |
122 | ctf_integer(unsigned long, wait_usec, (unsigned long) waittime) |
123 | ctf_integer(unsigned long, wait_nsec_rem, do_div(waittime, NSEC_PER_USEC)) | |
7c68b363 | 124 | #endif |
f127e61e | 125 | ) |
7c68b363 AG |
126 | ) |
127 | ||
128 | #endif | |
129 | ||
130 | #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) */ | |
131 | ||
b283666f PW |
132 | #endif |
133 | ||
3bc29f0a | 134 | #endif /* LTTNG_TRACE_LOCK_H */ |
b283666f PW |
135 | |
136 | /* This part must be outside protection */ | |
137 | #include "../../../probes/define_trace.h" |