Simple Performance Lock Analysis Tool (splat).
Provides kernel
and pthread lock usage reports.
splat -i file [ -n file ] [ -o file ] [ -k kexList ] [ -d [ bfta ] ] [ -l address ] [ -c class] [ -s [ acelmsS ] ] [ -C cpus ] [ -S count ] [ -t start] [ -T stop]
splat -h [topic]
splat -j
splat (Simple Performance Lock Analysis Tool) is a software tool which post-processes AIX trace files to produce kernel simple and complex lock usage reports. It also produces pthread mutex read-write locks, and condition variables usage reports.
The following is a list of available help topics and a brief summary of each:
OVERVIEW | This text. |
INPUT | AIX trace hooks required in order to acquire useful output from splat. |
NAMES | What name utilities can be used to cause splat to map addresses to human-readable symbols. |
REPORTS | A description of each report that splat can produce and the formulas used to calculate reported values. |
SORTING | A list of all the available sorting options and how they are applied to splat's output. |
Splat takes as primary input an AIX trace file which has been collected with the AIX trace command. Before analyzing a trace with splat, you will need to make sure that the trace is collected with an adequate set of hooks, including the following:
106 DISPATCH 10C DISPATCH IDLE PROCESS 10E RELOCK 112 LOCK 113 UNLOCK 46D WAIT LOCK 600 HKWD_PTHREAD_SCHEDULER 603 HKWD_PTHREAD_TIMER 605 HKWD_PTHREAD_VPSLEEP 606 HKWD_PTHREAD_COND 607 HKWD_PTHREAD_MUTEX 608 HKWD_PTHREAD_RWLOCK 609 HKWD_PTHREAD_GENERAL
Capturing these lock and unlock trace events can cause serious performance degradation due to the frequency that locks are used in a multiprocessor environment. Therefore, lock trace event reporting is normally disabled. In order to enable lock trace event reporting, the following steps must be taken before a trace can be collected which will include lock trace events that splat requires (KornShell syntax):
1. bosboot -ad /dev/hdisk0 -L 2. shutdown -Fr 3. (reboot the machine) 4. locktrace -S 5. mkdir temp.lib; cd temp.lib 6. ln -s /usr/ccs/lib/perf/libpthreads.a 7. export LIBPATH=$PWD:$LIBPATH
Steps 1 through 3 are necessary for activating the kernel-lock instrumentation; please refer to bosboot(1) for more information on bosboot and its flags. Steps 4 through 6 are necessary for activating the user pthread lock instrumentation; the temp.lib subdirectory can be put anywhere. Steps 1 through 7 are necessary in order for the report to be complete.
Splat can take the output of gennames as an optional input and use it to map lock and function addresses to human-readable symbols. The gennames system utility began shipping with AIX 4.3.1.
If gennames output is not available, splat will use the local file /usr/include/sys/lockname.h to identify lockclass symbols. Lockclasses and offsets can be used to identify a lock broadly, but not as specifically as the actual symbol. Additionally, this mapping may not be completely accurate if the AIX trace file is post-processed on a machine installed with a different version of AIX.
The report generated by splat consists of a report summary, a lock summary report section, and a list of lock detail reports, each of which may have an associated function detail and/or thread detail report.
Report Summary ^^^^^^^^^^^^^^ The report summary consists of the following elements: - The trace command used to collect the trace. - The host that the trace was taken on. - The date that the trace was taken on. - The duration of the trace in seconds. - The estimated number of CPUs - The combined elapsed duration of the trace in seconds; ( the duration of the trace multiplied by the number of CPUs identified during the trace ). - Start time, which is the offset in seconds from the beginning of the trace that trace statistics begin to be gathered. - Stop time, which is the offset in seconds from the beginning of the trace that trace statistics stop being gathered. - Total number of acquisitions during the trace. - Acquisitions per second, which is computed by dividing the total number of lock acquisitions by the real-time duration of the trace. - % of Total Spin Time, this is the summmation of all lock spin hold times, divided by the combined trace duration in seconds, divided by 100. The current goal is to have this value be less than 10% of the total trace duration. Lock Summary ^^^^^^^^^^^^ The lock summary report has the following fields: Lock The name, lockclass or address of the lock. Acquisitions The number of successful lock attempts for this lock, minus the number of times a thread was preempted while holding this lock. Spins The number of unsuccessful lock attempts for this lock, minus the number of times a thread was undispatched while spinning. Wait The number of unsuccessful lock attempts that resulted in the attempting thread going to sleep to wait for the lock to become available. %Miss Spins divided by Acquisitions plus Spins, multiplied by 100. %Total Acquisitions divided by the total number of all lock acquisitions, multiplied by 100. Locks/CSec Acquisitions divided by the combined elapsed duration in seconds. Percent HoldTime CPU The percent of combined elapsed trace time that threads held the lock in question while dispatched. DISPATCHED_HOLDTIME_IN_SECONDS divided by combined trace duration, multiplied by 100. Elaps(ed) The percent of combined elapsed trace time that threads held the lock while dispatched and sleeping. UNDISPATCHED_AND_DISPATCHED_HOLDTIME_IN_SECONDS divided by combined trace duration, multiplied by 100. Spin The percent of combined elapsed trace time that threads spun while waiting to acquire this lock. SPIN_HOLDTIME_IN_SECONDS divided by combined trace duration, multiplied by 100.
The lock summary report defaults to a list of ten locks, sorted in descending order by percent spin hold time ( the tenth field ). The length of the summary report can be adjusted using the -S switch. The sorted order of the summary report ( and all other reports ) can be set with the -s switch whose options are described in the SORTING help section, splat -h sorting.
Lock Detail ^^^^^^^^^^^ The lock detail report consists of the following fields: LOCK The address (in hexadecimal) of the lock. NAME The symbol mapping for that address (if available) CLASS The lockclass name (if available) and hexidecimal offset, used to allocate this lock ( lock_alloc() kernel service ). KEX The kernel address space that splat thinks that this lock belongs in ( generated if name data is available ). Acquisitions The number of successful lock attempts for this lock. Miss Rate The number of unsuccessful lock attempts divided by Acquisitions plus unsuccessful lock attempts, multiplied by 100. Spin Count The number of unsuccessful lock attempts. Wait Count The number of unsuccessful lock attempts that resulted in the attempting thread going to sleep to wait for the lock to become available. Busy Count The number of simple_lock_try() calls that returned busy. Seconds Held CPU The total time in seconds that this lock was held by dispatched threads. Elapsed The total time in seconds that this lock was held by both dispatched and undispatched threads. NOTE: neither of these two values should exceed the total real elapsed duration of the trace. Percent HoldTime CPU The percent of combined elapsed trace time that threads held the lock in question while dispatched. DISPATCHED_HOLDTIME_IN_SECONDS divided by trace duration, multiplied by 100. Elaps(ed) The percent of combined elapsed trace time that threads held the lock while dispatched and sleeping. UNDISPATCHED_AND_DISPATCHED_HOLDTIME_IN_SECONDS divided by trace duration, multiplied by 100. Spin The percent of combined elapsed trace time that threads spun while waiting to acquire this lock. SPIN_HOLDTIME_IN_SECONDS divided by trace duration, multiplied by 100. %Enabled The ratio of acquisitions of this lock that occurred with interrupts enabled to the total number of acquisitions. The number in parenthesis is the number of enabled acquisitions. %Disabled The ratio of acquisitions of this lock that occurred with interrupts disabled to the total number of acquisitions. The number in parenthesis is the number of disabled acquisitions. SpinQ Splat keeps track of the minimum, maximum and average depth of the spin queue (the threads spinning, waiting for a lock to become available). WaitQ As with the spin queue, splat also tracks the minimum, maximum and average depth of the queue of threads waited waiting for a lock to become available). Lock Activity w/Interrupts Enabled (mSecs) Lock Activity w/Interrupts Disabled (mSecs)
These two sections of the lock detail report are dumps of the raw data that splat collects for each lock, times expressed in milliseconds. The five states: LOCK, SPIN, WAIT, UNDISP(atched) and PREEMPT are the five basic states of splat's simple_lock finite state machine. The count for each state is the number of times a thread's actions resulted in a transition into that state. The durations in milliseconds show the minimum, maximum, average and total amounts of time that a lock request spent in that state.
LOCK: this state represents a thread successfully acquiring a lock. SPIN: this state represents a thread unsuccessfully trying to acquire a lock. WAIT: this state represents a spinning thread (in SPIN) going to sleep (voluntarily) after exceeding the thread's spin threshold. UNDISP: this state represents a spinning thread (in SPIN) becoming undispatched (involuntarily) before exceeding the thread's spin threshold. PREEMPT: this state represents when a thread holding a lock is undispatched. Function Detail ^^^^^^^^^^^^^^^ The function detail report consists of the following fields: Function Name The name or return address of the function which called simple_lock, simple_lock_try, simple_unlock, disable_lock or unlock_enable. Acquisitions The number of successful lock attempts for this lock. Miss Rate The number of unsuccessful lock attempts divided by Acquisitions, multiplied by 100. Spin Count The number of unsuccessful lock attempts. Wait Count The number of unsuccessful lock attempts that resulted in the attempting thread going to sleep to wait for the lock to become available. Busy Count The number of simple_lock_try() calls that returned busy. Seconds Held CPU The total time in seconds that this lock was held by dispatched threads. Elapsed The total time in seconds that this lock was held by both dispatched and undispatched threads. NOTE: neither of these two values should exceed the total real elapsed duration of the trace. Percent HoldTime CPU The percent of combined elapsed trace time that threads held the lock in question while dispatched. DISPATCHED_HOLDTIME_IN_SECONDS divided by trace duration, multiplied by 100. Elaps(ed) The percent of combined elapsed trace time that threads held the lock while dispatched and sleeping. UNDISPATCHED_AND_DISPATCHED_HOLDTIME_IN_SECONDS divided by trace duration, multiplied by 100. Spin The percent of combined elapsed trace time that threads spun while waiting to acquire this lock. SPIN_HOLDTIME_IN_SECONDS divided by combined trace duration, multiplied by 100. Return Address The calling function's return address in hexidecimal. Start Address The start address of the calling function in hexidecimal. Offset The offset from the function start address in hexidecimal. Thread Detail ^^^^^^^^^^^^^ The thread detail report consists of the following fields: ThreadID Thread identifier. Acquisitions The number of successful lock attempts for this lock. Miss Rate The number of unsuccessful lock attempts divided by Acquisitions, multiplied by 100. Spin Count The number of unsuccessful lock attempts. Wait Count The number of unsuccessful lock attempts that resulted in the attempting thread going to sleep to wait for the lock to become available. Busy Count The number of simple_lock_try() calls that returned busy. Seconds Held CPU The total time in seconds that this lock was held by dispatched threads. Elapsed The total time in seconds that this lock was held by both dispatched and undispatched threads. NOTE: neither of these two values should exceed the total real elapsed duration of the trace. Percent HoldTime CPU The percent of combined elapsed trace time that threads held the lock in question while dispatched. DISPATCHED_HOLDTIME_IN_SECONDS divided by trace duration, multiplied by 100. Elaps(ed) The percent of combined elapsed trace time that threads held the lock while dispatched and sleeping. UNDISPATCHED_AND_DISPATCHED_HOLDTIME_IN_SECONDS divided by trace duration, multiplied by 100. Spin The percent of combined elapsed trace time that threads spun while waiting to acquire this lock. SPIN_HOLDTIME_IN_SECONDS divided by combined trace duration, multiplied by 100.
splat allows the user to specify which criteria is used to sort the summary and lock detail reports using the -s option. The default sorting criteria is to sort by percent spin hold time, which is the ratio of time that threads spent spinning for a lock compared to the combined duration of the trace. Using -s, the sort criteria can be changed to the following:
a | Acquisitions; the number times a thread successfully acquired a lock. |
c | Percent CPU hold time; the ratio of CPU hold time with the combined trace duration. |
e | Percent Elapsed hold time; the ratio of elapsed hold time with the combined trace duration. |
l | location; the address of the lock or function, or the ID of a thread. |
m | Miss rate; the ratio missed lock attempts with the number of acquisitions. |
s | Spin count; the number of unsuccessful lock attempts that result in a thread spinning waiting for the lock. |
S | Percent CPU spin hold time (default). |
w | Percent elapsed wait time; the percent of the total time that a nonzero number of threads waited on the lock. |
W | Average waitq depth; the average number of threads waiting on the lock, equivalent to the average time each waiting thread spends in this state. |
splat will use the specified criteria to sort the lock reports in descending order.
Other types of locks, such as VMM, XMAP, and certain Java-specific locks are not analyzed.
/etc/bin/splat | Simple Performance Lock Analysis Tool (splat). Provides kernel and pthread lock usage reports. |
The simple_lock(3), simple_unlock(3), disable_lock(3), unlock_enable(3), trace(1), trcrpt(1), trcfmt(5), gennames(1) and bosboot(1) daemons.