Main index | Section 1 | Options |
lockstat gathers data until the specified command completes. For example, to gather statistics for a fixed-time interval, use sleep(1) as the command, as follows:
# lockstat sleep 5
When the
lockstat relies on DTrace to modify the running kernel's text to intercept events of interest. This imposes a small but measurable overhead on all system activity, so access to lockstat is restricted to super-user by default.
| |
Print the D program used to gather the requested data. | |
| |
Watch all lock events.
| |
| |
Watch contention events. | |
| |
Watch error events. | |
| |
Only watch the specified events. event-list is a comma-separated list of events or ranges of events such as 1,4-7,35. Run lockstat with no arguments to get a brief description of all events. | |
| |
Watch hold events. | |
| |
Watch profiling interrupt events. | |
| |
Interrupt rate (per second) for
| |
| |
Enable or modify a dtrace(1) runtime option or D compiler option. Boolean options are enabled by specifying their name. Options with values are set by separating the option name and value with an equals sign. | |
| |
Basic statistics: lock, caller, number of events. | |
| |
Histogram: timing plus time-distribution histograms. | |
| |
Stack trace: histogram plus stack traces up to depth frames deep. | |
| |
Timing: Basic plus timing for all events (default). | |
| |
Only watch events longer than duration. | |
| |
Only watch events generated by func, which can be specified as a symbolic name or hex address. size defaults to the ELF symbol size if available, or 1 if not. | |
| |
Only watch lock, which can be specified as a symbolic name or hex address. size defaults to the ELF symbol size or 1 if the symbol size is not available. | |
| |
Maximum number of data records. | |
| |
Trace (rather than sample) events. This is off by default. | |
| |
Only display the top count events of each type. | |
| |
Show total events generated by function.
For example, if
foo()
calls
bar()
in a loop, the work done by
bar()
counts as work generated by
foo()
(along with any work done by
foo()
itself).
The
| |
| |
Coalesce PCs within functions. | |
| |
Direct output to filename. | |
| |
Sort data by (count * time) product. | |
| |
Parsable output format. | |
| |
Display rates (events per second) rather than counts. | |
| |
Whichever: distinguish events only by caller, not by lock. | |
| |
Wherever: distinguish events only by lock, not by caller. | |
Count or ops/s | |
Number of times this event occurred, or the rate (times per second) if
| |
indv | Percentage of all events represented by this individual event. |
genr | Percentage of all events generated by this function. |
cuml | Cumulative percentage; a running total of the individuals. |
rcnt | Average reference count. This will always be 1 for exclusive locks (mutexes, spin locks, rwlocks held as writer) but can be greater than 1 for shared locks (rwlocks held as reader). |
nsec | Average duration of the events in nanoseconds, as appropriate for the event. For the profiling event, duration means interrupt latency. |
Lock | Address of the lock; displayed symbolically if possible. |
CPU+Pri_Class | |
CPU plus the priority class of the interrupted thread. For example, if CPU 4 is interrupted while running a timeshare thread, this will be reported as ‘cpu[4]+TShar’. | |
Caller | |
Address of the caller; displayed symbolically if possible. | |
Example 1 Measuring Kernel Lock Contention | |
# lockstat sleep 5 Adaptive mutex spin: 41411 events in 5.011 seconds (8263 events/sec) | |
Example 2 Measuring Hold Times | |
# lockstat -H -D 10 sleep 1 Adaptive mutex hold: 109589 events in 1.039 seconds (105526 events/sec) | |
Example 3 Measuring Hold Times for Stack Traces Containing a Specific Function | |
# lockstat -H -f tcp_input -s 50 -D 10 sleep 1 Adaptive mutex hold: 68 events in 1.026 seconds (66 events/sec) | |
The PC in the stack frame in which an interrupt occurs can be bogus because, between function calls, the compiler is free to use the return address register for local storage.
When using the
LOCKSTAT (1) | February 25, 2020 |
Main index | Section 1 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.