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