1 .\" Copyright (c) 2017 George V. Neville-Neil <gnn@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .Nd a DTrace provider for tracing CPU scheduling events
32 .Fn lockstat:::adaptive-acquire "struct mtx *"
33 .Fn lockstat:::adaptive-release "struct mtx *"
34 .Fn lockstat:::adaptive-spin "struct mtx *" "uint64_t"
35 .Fn lockstat:::adaptive-block "struct mtx *" "uint64_t"
36 .Fn lockstat:::spin-acquire "struct mtx *"
37 .Fn lockstat:::spin-release "struct mtx *"
38 .Fn lockstat:::spin-spin "struct mtx *" "uint64_t"
39 .Fn lockstat:::rw-acquire "struct rwlock *" "int"
40 .Fn lockstat:::rw-release "struct rwlock *" "int"
41 .Fn lockstat:::rw-block "struct rwlock *" "uint64_t" "int" "int" "int"
42 .Fn lockstat:::rw-spin "struct rwlock *" "uint64_t"
43 .Fn lockstat:::rw-upgrade "struct rwlock *"
44 .Fn lockstat:::rw-downgrade "struct rwlock *"
45 .Fn lockstat:::sx-acquire "struct sx *" "int"
46 .Fn lockstat:::sx-release "struct sx *" "int"
47 .Fn lockstat:::sx-block "struct sx *" "uint64_t" "int" "int" "int"
48 .Fn lockstat:::sx-spin "struct sx *" "uint64_t"
49 .Fn lockstat:::sx-upgrade "struct sx *"
50 .Fn lockstat:::sx-downgrade "struct sx *"
51 .Fn lockstat:::lockmgr-acquire "struct lock *" "int"
52 .Fn lockstat:::lockmgr-release "struct lock *" "int"
53 .Fn lockstat:::lockmgr-disown "struct lock *" "int"
54 .Fn lockstat:::lockmgr-block "struct lock *" "uint64_t" "int" "int" "int"
55 .Fn lockstat:::lockmgr-upgrade "struct lock *"
56 .Fn lockstat:::lockmgr-downgrade "struct lock *"
57 .Fn lockstat:::thread-spin "struct mtx *" "uint64"
61 provider allows the tracing of events related to locking on
66 provider contains DTrace probes for inspecting kernel lock
77 utility can be used to collect and display data collected from the
84 probes which expose the lock structure being operated upon,
85 as well as probes which fire when a thread contends with other threads
86 for ownership of a lock.
89 .Fn lockstat:::adaptive-acquire
91 .Fn lockstat:::adaptive-release
95 is acquired and released, respectively.
96 The only argument is a pointer to the lock structure which describes
97 the lock being acquired or released.
100 .Fn lockstat:::adaptive-spin
101 probe fires when a thread spins while waiting for a
104 to be released by another thread.
105 The first argument is a pointer to the lock structure that describes
106 the lock and the second argument is the amount of time,
107 in nanoseconds, that the mutex spent spinning.
109 .Fn lockstat:::adaptive-block
110 probe fires when a thread takes itself off the CPU while trying to acquire an
113 that is owned by another thread.
114 The first argument is a pointer to the lock structure that describes
115 the lock and the second argument is the length of time,
116 in nanoseconds, that the waiting thread was blocked.
118 .Fn lockstat:::adaptive-block
120 .Fn lockstat:::adaptive-spin
121 probes fire only after the lock has been successfully acquired,
122 and in particular, after the
123 .Fn lockstat:::adaptive-acquire
127 .Fn lockstat:::spin-acquire
129 .Fn lockstat:::spin-release
133 is acquired or released, respectively.
134 The only argument is a pointer to the lock structure which describes
135 the lock being acquired or released.
138 .Fn lockstat:::spin-spin
139 probe fires when a thread spins while waiting for a
142 to be released by another thread.
143 The first argument is a pointer to the lock structure that describes
144 the lock and the second argument is the length of the time
145 spent spinning, in nanoseconds.
147 .Fn lockstat:::spin-spin
148 probe fires only after the lock has been successfully acquired,
149 and in particular, after the
150 .Fn lockstat:::spin-acquire
154 .Fn lockstat:::rw-acquire
156 .Fn lockstat:::rw-release
159 is acquired or released, respectively.
160 The first argument is a pointer to the structure which describes
161 the lock being acquired.
162 The second argument is
164 if the lock is being acquired or released as a writer, and
166 if it is being acquired or released as a reader.
168 .Fn lockstat:::sx-acquire
170 .Fn lockstat:::sx-release ,
172 .Fn lockstat:::lockmgr-acquire
174 .Fn lockstat:::lockmgr-release
175 probes fire upon the corresponding events for
181 .Fn lockstat:::lockmgr-disown
184 exclusive lock is disowned.
185 In this state, the lock remains exclusively held, but may be
186 released by a different thread.
188 .Fn lockstat:::lockmgr-release
189 probe does not fire when releasing a disowned lock.
190 The first argument is a pointer to the structure which describes
191 the lock being disowned.
192 The second argument is
194 for compatibility with
195 .Fn lockstat:::lockmgr-release .
198 .Fn lockstat:::rw-block ,
199 .Fn lockstat:::sx-block ,
201 .Fn lockstat:::lockmgr-block
202 probes fire when a thread removes itself from the CPU while
203 waiting to acquire a lock of the corresponding type.
205 .Fn lockstat:::rw-spin
207 .Fn lockstat:::sx-spin
208 probes fire when a thread spins while waiting to acquire a lock
209 of the corresponding type.
210 All probes take the same set of arguments.
211 The first argument is a pointer to the lock structure that describes
213 The second argument is the length of time, in nanoseconds,
214 that the waiting thread was off the CPU or spinning for the lock.
215 The third argument is
217 if the thread is attempting to acquire the lock as a writer, and
219 if the thread is attempting to acquire the lock as a reader.
220 The fourth argument is
222 if the thread is waiting for a reader to release the lock, and
224 if the thread is waiting for a writer to release the lock.
225 The fifth argument is the number of readers that held the lock when
226 the thread first attempted to acquire the lock.
227 This argument will be
229 if the fourth argument is
233 .Fn lockstat:::lockmgr-upgrade ,
234 .Fn lockstat:::rw-upgrade ,
236 .Fn lockstat:::sx-upgrade
237 probes fire when a thread successfully upgrades a held
242 shared/reader lock to an exclusive/writer lock.
243 The only argument is a pointer to the structure which describes
244 the lock being acquired.
246 .Fn lockstat:::lockmgr-downgrade ,
247 .Fn lockstat:::rw-downgrade ,
249 .Fn lockstat:::sx-downgrade
250 probes fire when a thread downgrades a held
255 exclusive/writer lock to a shared/reader lock.
258 .Fn lockstat:::thread-spin
259 probe fires when a thread spins on a thread lock, which is a specialized
262 The first argument is a pointer to the structure that describes
263 the lock and the second argument is the length of time,
264 in nanoseconds, that the thread was spinning.
276 provider first appeared in Solaris.
279 implementation of the
281 provider first appeared in
284 This manual page was written by
285 .An George V. Neville-Neil Aq Mt gnn@FreeBSD.org
288 .An Mark Johnston Aq Mt markj@FreeBSD.org .
292 locks have not yet been added.