1 .\" $NetBSD: lockstat.8,v 1.8 2008/04/30 13:11:02 martin Exp $
3 .\" Copyright (c) 2006, 2007, 2009 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd display kernel locking statistics
50 command enables system wide tracing of kernel lock events, executes
51 the specified command, and when finished reports statistics to the user.
53 Tracing may be ended early by sending
55 (Ctrl-C) to the process being executed by lockstat.
60 driver must be present in the kernel, and the
62 command may only be used by the root user.
64 The options are as follows:
65 .Bl -tag -width wellhello
67 Adjust the number of trace buffers allocated by the kernel to
70 Report percentage of total events by count, and sort the output by number
72 The default is to key on event timings.
74 Limit tracing to one type of event.
77 option to list valid events.
79 List valid event types for the
83 Limit tracing to locking operations performed within the specified function.
85 must be the name of a valid function in the kernel.
87 Trace only by calling functions; do not report on individual locks.
89 Limit tracing to one lock.
91 may either be the name of a lock object in the kernel, or a kernel virtual
94 Trace only by lock; do not report on calling functions.
96 Merge lock addresses within unique objects.
98 Merge call sites within unique functions.
100 Extract symbol information from the
104 Send output to the file named by
106 instead of the standard output (the default).
108 Show the average number of events and time spent per CPU.
109 The default is to show the total values.
110 May be used in conjunction with the
114 Show the average number of events per second, and the average time spent per
116 The default is to show the total values.
118 Limit tracing to one type of lock.
121 option to list valid lock types.
123 List valid lock types for the
127 Summarize events, and do not report on lock types.
130 .Bl -tag -width /dev/lockstat -compact
139 # lockstat -L uvm_pageqlock sleep 10
140 Elapsed time: 10.01 seconds.
142 -- Adaptive mutex spin
144 Total% Count Time/ms Lock Caller
145 ------ ------- --------- ---------------------- ------------------------------
146 100.00 1281 0.78 uvm_pageqlock \*[Lt]all\*[Gt]
147 39.81 385 0.31 uvm_pageqlock uvm_fault_internal+11cc
148 30.98 358 0.24 uvm_pageqlock uvm_fault_internal+bb1
149 28.06 522 0.22 uvm_pageqlock uvm_anfree+132
150 0.51 5 0.00 uvm_pageqlock ubc_fault+28f
151 0.20 4 0.00 uvm_pageqlock uvm_fault_internal+12b6
152 0.18 2 0.00 uvm_pageqlock uao_detach_locked+58
153 0.11 2 0.00 uvm_pageqlock uvm_fault_internal+7d5
154 0.08 2 0.00 uvm_pageqlock ufs_balloc_range+160
155 0.07 1 0.00 uvm_pageqlock uvm_fault_internal+107b
159 .It "lockstat: incompatible lockstat interface version"
161 The kernel device driver does not match the version of the
164 .It "lockstat: overflowed available kernel trace buffers"
166 Increase the number of buffers using the
169 .It "lockstat: ioctl: Invalid argument"
171 The number of trace buffers is outside the minimum and maximum
172 bounds set by the kernel.