LOCK_PROFILING(9) | Kernel Developer's Manual | LOCK_PROFILING(9) |
LOCK_PROFILING
—
kernel lock profiling support
options LOCK_PROFILING
The LOCK_PROFILING
kernel option adds
support for measuring and reporting lock use and contention statistics.
These statistics are collated by “acquisition point”.
Acquisition points are distinct places in the kernel source code (identified
by source file name and line number) where a lock is acquired.
For each acquisition point, the following statistics are accumulated:
In addition, the average hold time and average wait time are derived from the total hold time and total wait time respectively and the number of acquisitions.
The LOCK_PROFILING
kernel option also adds
the following sysctl(8) variables to control and monitor
the profiling code:
Mutex profiling support appeared in FreeBSD 5.0. Generalized lock profiling support appeared in FreeBSD 7.0.
The MUTEX_PROFILING
code was written by
Eivind Eklund
<eivind@FreeBSD.org>,
Dag-Erling Smørgrav
<des@FreeBSD.org> and
Robert Watson
<rwatson@FreeBSD.org>.
The LOCK_PROFILING
code was written by
Kip Macy
<kmacy@FreeBSD.org>.
This manual page was written by Dag-Erling
Smørgrav
<des@FreeBSD.org>.
The LOCK_PROFILING
option increases the
size of struct lock_object, so a kernel built with
that option will not work with modules built without it.
The LOCK_PROFILING
option also prevents
inlining of the mutex code, which can result in a fairly severe performance
penalty. This is, however, not always the case.
LOCK_PROFILING
can introduce a substantial
performance overhead that is easily monitorable using other profiling tools,
so combining profiling tools with LOCK_PROFILING
is
not recommended.
Measurements are made and stored in nanoseconds using nanotime(9), (on architectures without a synchronized TSC) but are presented in microseconds. This should still be sufficient for the locks one would be most interested in profiling (those that are held long and/or acquired often).
LOCK_PROFILING
should generally not be
used in combination with other debugging options, as the results may be
strongly affected by interactions between the features. In particular,
LOCK_PROFILING
will report higher than normal
uma(9) lock contention when run with
INVARIANTS
due to extra locking that occurs when
INVARIANTS
is present; likewise, using it in
combination with WITNESS
will lead to much higher
lock hold times and contention in profiling output.
March 7, 2012 | Debian |