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