[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Commands Reference, Volume 3

lockstat Command

Purpose

Displays simple and complex lock contention information.

Syntax

lockstat [ -a ][ -c LockCount ] [ -b BlockRatio ] [ -n CheckCount ] [ -p LockRate ]

[ -t MaxLocks ] [ Interval [Count ] ]

Description

Note: To enable lock statistics collection, the bosboot -L command must be executed.

The lockstat command reports statistics about contention in the operating system among simple and complex kernel locks. Reports generated by the lockstat command can be used to ensure that system performance is not being reduced by excessive lock contention.

The lockstat command generates a report for each kernel lock which meets all the specified conditions. If no condition values are specified, default conditions are used. The reports give information about the number of lock requests for each lock. A lock request is a lock operation (such as taking or upgrading a lock) which in some cases cannot be satisfied immediately. A lock request which cannot be satisfied at once is said to block. A blocked request will either spin (repeatedly execute instructions which do nothing) or sleep (allowing another thread to execute).

The column headings in the lockstat command listing have the following meanings:

Subsys The subsystem to which the lock belongs.
Name The symbolic name of the lock class.
Ocn The occurrence number of the lock in its class.
Ref/s The reference rate, or number of lock requests per second.
%Ref The reference rate expressed as a percentage of all lock requests.
%Block The ratio of blocking lock requests to total lock requests. A block occurs whenever the lock cannot be taken immediately.
%Sleep The percentage of lock requests that cause the calling thread to sleep.

Flags

-a Displays a supplementary list showing the most requested (or active) locks, regardless of the conditions defined by other flags.
-c LockCount Specifies how many times a lock must be requested during an interval in order to be displayed. The default value of the LockCount parameter is 200.
-b BlockRatio Specifies a block ratio. A lock must have a block ratio that is higher than the specified BlockRatio parameter in order to be listed. The default value of the BlockRatio parameter is five percent.
-n CheckCount Specifies the number of locks that are to be checked. The lockstat command sorts locks according to lock activity. The CheckCount parameter determines how many of the most active locks will be subject to further checking. Limiting the number of locks that are checked maximizes system performance, particularly if the Count parameter is used to run the lockstat command repeatedly. By default, the 40 most active locks are checked.
-p LockRate Specifies a percentage of the activity of the most-requested lock in the kernel. Only locks that are more active than this will be listed. The default LockRate value is two, meaning that the only locks listed are those requested at least two percent as often as the most active lock. Note that LockRate is not the same concept as the %Ref field, which is relative to the total number of lock requests.
-t MaxLocks Specifies the maximum number of locks to be displayed. The default is to list up to 10 locks.

Parameters

Interval Specifies the amount of time in seconds between each report. Each report contains statistics collected during the interval since the previous report. If the Interval parameter is not specified, the lockstat command generates a single report covering an interval of one second and then exits.
Count Determines the number of reports generated. The Count parameter can only be specified with the Interval parameter. If the Interval parameter is specified without the Count parameter, reports are continuously generated. A Count parameter of 0 is not allowed./TD>

Examples

  1. To generate a single lock statistic report based on default conditions, enter:
    lockstat
    The output is similar to:
    Subsys   Name                Ocn   Ref/s   %Ref   %Block   %Sleep
    -----------------------------------------------------------------
    PROC     PROC_LOCK_CLASS      2    1442    3.06    6.98     0.75
    PROC     PROC_INT_CLASS       1    1408    2.98    5.86     1.77
    IOS      IOS_LOCK_CLASS       4     679    1.44    5.19     2.29
  2. To generate 100 lock statistic reports at one second intervals, displaying only those locks which are more than 50 percent as active as the most active lock, enter:
    lockstat -p
    50 1 100

File

/usr/bin/lockstat Contains the lockstat command.

Related Information

The iostat command, vmstat command, and the bosboot command.

The dlock subcommand for the crash command.

The /dev/kmem special file.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]