LOCKSTAT(8)             NetBSD System Manager's Manual             LOCKSTAT(8)

NAME
     lockstat -- display kernel locking statistics

SYNOPSIS
     lockstat [-ceflMmpst] [-b nbuf] [-E event] [-F func] [-L lock] [-N nlist]
              [-o file] [-T type] command ...

DESCRIPTION
     The lockstat command enables system wide tracing of kernel lock events,
     executes the specified command, and when finished reports statistics to
     the user.

     Tracing may be ended early by sending SIGINT (Ctrl-C) to the process
     being executed by lockstat.

     The lockstat pseudo-device driver must be present in the kernel, and the
     lockstat command may only be used by the root user.

     The options are as follows:

     -b nbuf    Adjust the number of trace buffers allocated by the kernel to
                nbuf.

     -c         Report percentage of total events by count, and sort the out-
                put by number of events.  The default is to key on event tim-
                ings.

     -E event   Limit tracing to one type of event.  Use the -e option to list
                valid events.

     -e         List valid event types for the -E option and exit.

     -F func    Limit tracing to locking operations performed within the spec-
                ified function.  func must be the name of a valid function in
                the kernel.

     -f         Trace only by calling functions; do not report on individual
                locks.

     -L lock    Limit tracing to one lock.  lock may either be the name of a
                lock object in the kernel, or a kernel virtual address.

     -l         Trace only by lock; do not report on calling functions.

     -M         Merge lock addresses within unique objects.

     -m         Merge call sites within unique functions.

     -N nlist   Extract symbol information from the nlist file.

     -o file    Send output to the file named by file, instead of the standard
                output (the default).

     -p         Show the average number of events and time spent per CPU.  The
                default is to show the total values.  May be used in conjunc-
                tion with the -s option.

     -s         Show the average number of events per second, and the average
                time spent per second.  The default is to show the total val-
                ues.

     -T type    Limit tracing to one type of lock.  Use the -t option to list
                valid lock types.

     -t         List valid lock types for the -T option and exit.

FILES
     /dev/lockstat  lockstat control device
     /dev/ksyms     default namelist
     /netbsd        namelist

EXAMPLES
     # lockstat -T kernel_lock sleep 10
     Elapsed time: 10.01 seconds.

     -- Kernel lock spin

     Total%  Count   Time/ms          Lock                       Caller
     ------ ------- --------- ---------------------- ------------------------------
     100.00   74941   1545.54 kernel_lock            <all>
      43.54   28467    673.00 kernel_lock            trap+71e
      42.87   34466    662.51 kernel_lock            syscall_plain+111
       7.38    7565    114.14 kernel_lock            uiomove+17a
       1.92    1221     29.61 kernel_lock            sleepq_block+20b
       1.84    1759     28.40 kernel_lock            trap+706
       0.81     124     12.54 kernel_lock            x86_softintlock+1a
       0.64     587      9.87 kernel_lock            pmap_load+2a6
       0.52     214      8.10 kernel_lock            intr_biglock_wrapper+1e
       0.20     219      3.09 kernel_lock            pmap_load+323
       0.14     175      2.12 kernel_lock            do_sys_wait+2d0
       0.09      85      1.43 kernel_lock            lwp_startup+66
       0.04      49      0.64 kernel_lock            sleepq_block+18c
       0.01      10      0.12 kernel_lock            lwp_userret+3c

DIAGNOSTICS
     lockstat: incompatible lockstat interface version

     The kernel device driver does not match the version of the lockstat com-
     mand.

     lockstat: overflowed available kernel trace buffers

     Increase the number of buffers using the -b option.

     lockstat: ioctl: Invalid argument

     The number of trace buffers is outside the minimum and maximum bounds set
     by the kernel.

SEE ALSO
     ps(1), systat(1), vmstat(1), iostat(8), pstat(8)

HISTORY
     The lockstat command appeared in NetBSD 4.0.

NetBSD 5.0_STABLE                July 14, 2007               NetBSD 5.0_STABLE
