[AIX 성능 도구 3] splat — 잠금 분석 도구

핵심 정리

  • splat은 trace에서 잠금 이벤트를 읽어 AIX 커널 잠금(simple, complex, RunQ)과 pthread 동기화 객체(뮤텍스, 읽기/쓰기 잠금, 조건 변수)의 사용과 경합을 보고합니다. VMM·PMAP 잠금은 분석하지 못합니다.
  • trace는 trace -J splat(splat에 필요한 훅만)으로 뜨고, gensyms 출력(-n)을 주면 잠금·함수 주소가 이름으로 바뀝니다. splat -j는 쓰는 훅 ID 목록입니다.
  • 보고서 순서: 실행 요약 → 전체 잠금 요약(Gross) → 잠금별 요약 → 잠금 상세(-df 함수, -dt 스레드, -da 모두).
  • 핵심 지표는 % Total System spin Time(스핀 시간이 CPU 시간의 10%를 넘으면 * 표시), Miss Rate, Spin Count, Wait Count, Percent Held입니다.
  • -S로 보고할 개수(기본 10), -s로 정렬 기준(기본 S: 스핀 보유 시간 비율)을 정합니다. trace가 중간에 끊기면 끊긴 곳에서 분석을 멈추고 경고합니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (내용이 같고 6.1판은 문장만 다듬어짐)
원문 Performance Tools Guide and Reference — 5.3판 4장(103122쪽), 6.1판 3249쪽
명령 /usr/bin/splat (bos.perf.tools 파일 세트)
관련 명령어 trace, trcrpt, gensyms, gennames, curt

단순 성능 잠금 분석 도구(Simple Performance Lock Analysis Tool, splat)는 동기화 잠금의 사용을 보고하는 소프트웨어 도구입니다. AIX 커널이 제공하는 simple·complex 잠금과, PThread 라이브러리가 제공하는 사용자 수준 뮤텍스, 읽기/쓰기 잠금, 조건 변수가 대상입니다.

splat 도구는 지금은 AIX 커널이 쓰는 VMM(가상 메모리 관리자)·PMAP 잠금의 동작은 분석하지 못합니다.

영어 원문

Simple performance lock analysis tool (splat)

The Simple Performance Lock Analysis Tool (splat) is a software tool that generates reports on the use of synchronization locks. These include the simple and complex locks provided by the AIX kernel, as well as user-level mutexes, read and write locks, and condition variables provided by the PThread library.

The splat tool is not currently equipped to analyze the behavior of the Virtual Memory Manager (VMM) and PMAP locks used in the AIX kernel.

splat 명령의 구문

splat 명령의 구문, 플래그, 매개변수입니다.

text
splat [-i file] [-n file] [-o file] [-d [bfta]] [-l address] [-c class] [-s [acelmsS]] [-C#] [-S#] [-t start] [-T stop] [-p]
splat -h [topic]
splat -j

플래그

플래그 설명
-i inputfile AIX trace 로그 입력 파일을 지정합니다.
-n namefile gensyms 명령의 출력이 든 파일을 지정합니다.
-o outputfile 출력 파일을 지정합니다(기본은 표준 출력).
-d detail 보고서의 상세 수준을 지정합니다.
-c class 보고할 잠금 클래스를 지정합니다.
-l address 잠금 활동을 보고할 주소를 지정합니다.
-s criteria 잠금, 함수, 스레드의 정렬 순서를 지정합니다.
-C CPUs trace를 뜬 MP 시스템의 프로세서 수. 기본 1이며, trace에서 더 많은 프로세서가 보이면 그 값을 씁니다.
-S count 각 절에서 보고할 항목 수. 기본 10. Lock Summary·Lock Detail 보고서의 잠금 수, Function Detail의 함수 수, Thread Detail의 스레드 수입니다(가장 중요한 잠금·스레드·함수를 고르는 방법은 -s로 정합니다).
-t starttime trace에 기록된 첫 이벤트의 시작 시각 대신, 첫 이벤트에서 starttime초 뒤의 이벤트부터 분석합니다.
-T stoptime trace에 기록된 마지막 이벤트의 끝 시각 대신, 첫 이벤트에서 stoptime초 뒤의 이벤트에서 분석을 끝냅니다.
-j splat 명령이 쓰는 trace 훅 ID 목록을 출력합니다.
-h topic 사용법이나 특정 주제의 도움말을 출력합니다.
-p CPU 시간 계산에 PURR 레지스터를 씁니다.

매개변수

매개변수 설명
inputfile AIX trace 로그 입력 파일. trcrpt -r 명령으로 합친 trace 파일도 됩니다.
namefile gensyms 명령의 출력이 든 파일
outputfile 보고서를 쓸 파일
detail 보고서 상세 수준. basic 잠금 요약 + 잠금 상세(기본), function basic + 함수 상세, thread basic + 스레드 상세, all basic + 함수 상세 + 스레드 상세
class 활동 클래스. /usr/include/sys/lockname.h 파일에 있는 10진수 값
address 보고할 주소(16진수)
criteria 잠금·함수·스레드 보고서의 정렬 기준. a 획득 횟수, c 프로세서 시간 보유 비율, e 경과 시간 보유 비율, l 잠금 주소·함수 주소·스레드 ID, m 실패율(miss rate), s 스핀 횟수, S 프로세서 스핀 보유 시간 비율(기본)
CPUs trace를 뜬 MP 시스템의 프로세서 수. 기본 1이며, trace에서 더 많은 프로세서가 보이면 그 값을 씁니다.
count Lock Summary·Lock Detail 보고서의 잠금 수와 Function Detail의 함수 수, Thread Detail의 스레드 수(가장 중요한 것을 고르는 방법은 -s로 정함)
starttime trace에 기록된 첫 이벤트에서 몇 초 뒤부터 보고할지
stoptime trace에 기록된 첫 이벤트에서 몇 초 뒤에 보고를 멈출지
topic 도움말 주제: all, overview, input, names, reports, sorting
영어 원문

splat command syntax

Review the splat command syntax, flags, and parameters.

The syntax for the splat command is as follows:

splat [-i file] [-n file] [-o file] [-d [bfta]] [-l address][-c class] [-s [acelmsS]] [-C#] [-S#] [-t start] [-T stop] [-p]

splat -h [topic]

splat -j

Flags

  • -i inputfile — Specifies the &SWsym.AIX; trace log file input.
  • -n namefile — Specifies the file containing output of the gensyms command.
  • -o outputfile — Specifies an output file (default is stdout).
  • -d detail — Specifies the level of detail of the report.
  • -c class — Specifies class of locks to be reported.
  • -l address — Specifies the address for which activity on the lock will be reported.
  • -s criteria — Specifies the sort order of the lock, function, and thread.
  • -C CPUs — Specifies the number of processors on the MP system that the trace was drawn from. The default is 1. This value is overridden if more processors are observed to be reported in the trace.
  • -S count — Specifies the number of items to report on for each section. The default is 10. This gives the number of locks to report in the Lock Summary and Lock Detail reports, as well as the number of functions to report in the Function Detail and threads to report in the Thread detail (the -s option specifies how the most significant locks, threads, and functions are selected).
  • -t starttime — Overrides the start time from the first event recorded in the trace. This flag forces the analysis to begin an event that occurs starttime seconds after the first event in the trace.
  • -T stoptime — Overrides the stop time from the last event recorded in the trace. This flag forces the analysis to end with an event that occurs stoptime seconds after the first event in the trace.
  • -j — Prints the list of IDs of the trace hooks used by the splat command.
  • -h topic — Prints a help message on usage or a specific topic.
  • -p — Specifies the use of the PURR register to calculate CPU times.

Parameters

  • inputfile — The AIX trace log file input. This file can be a merge trace file generated using the trcrpt -r command.
  • namefile — File containing output of the gensyms command.
  • outputfile — File to write reports to.
  • detail — The detail level of the report, it can be one of the following: basic Lock summary plus lock detail (the default) function Basic plus function detail thread Basic plus thread detail all Basic plus function plus thread detail
  • class — Activity classes, which is a decimal value found in the /usr/include/sys/lockname.h file.
  • address — The address to be reported, given in hexadecimal.
  • criteria — Order the lock, function, and thread reports by the following criteria: a Acquisitions c Percent processor time held e Percent elapsed time held l Lock address, function address, or thread ID m Miss rate s Spin count S Percent processor spin hold time (the default)
  • CPUs — The number of processors on the MP system that the trace was drawn from. The default is 1. This value is overridden if more processors are observed to be reported in the trace.
  • count — The number of locks to report in the Lock Summary and Lock Detail reports, as well as the number of functions to report in the Function Detail and threads to report in the Thread detail. (The -s option specifies how the most significant locks, threads, and functions are selected).
  • starttime — The number of seconds after the first event recorded in the trace that the reporting starts.
  • stoptime — The number of seconds after the first event recorded in the trace that the reporting stops.
  • topic — Help topics, which are: all overview input names reports sorting

측정과 표본 수집

splat 도구는 AIX trace 로그 파일 하나(SMP trace면 로그 파일 여러 개)와, 되도록 gennames나 gensyms 명령이 만든 이름 파일을 입력으로 받습니다.

이 파일을 만드는 절차는 trace 설명에 있습니다. trace를 실행할 때 보통 -J splat 플래그로 splat이 분석하는 이벤트만 잡습니다(-J 없이 모든 이벤트를 잡아도 됩니다). 중요한 trace 훅은 다음과 같습니다.

훅 ID 이벤트 이름 설명
106 HKWD_KERN_DISPATCH 스레드가 실행 대기열에서 프로세서로 디스패치됨
10C HKWD_KERN_IDLE idle 프로세스가 디스패치됨
10E HKWD_KERN_RELOCK 한 스레드가 중단되고 다른 스레드가 디스패치됨. RunQ 잠금의 소유권이 앞 스레드에서 뒤 스레드로 넘어감
112 HKWD_KERN_LOCK 스레드가 커널 잠금을 얻으려 함. 하위 훅이 결과를 보여 줌
113 HKWD_KERN_UNLOCK 커널 잠금이 풀림
134 HKWD_SYSC_EXECVE (fork된) 프로세스가 exec 감독자 호출(SVC)을 냄
139 HKWD_SYSC_FORK 프로세스가 fork SVC를 냄
419 HKWD_CPU_PREEMPT 프로세스가 선점됨
465 HKWD_SYSC_CRTHREAD 프로세스가 thread_create SVC를 냄
46D HKWD_KERN_WAITLOCK 스레드가 커널 잠금을 기다리는 대기열에 들어감
46E HKWD_KERN_WAKEUPLOCK 스레드가 깨어남
606 HKWD_PTHREAD_COND 조건 변수에 대한 작업
607 HKWD_PTHREAD_MUTEX 뮤텍스에 대한 작업
608 HKWD_PTHREAD_RWLOCK 읽기/쓰기 잠금에 대한 작업
609 HKWD_PTHREAD_GENERAL PThread에 대한 작업
영어 원문

Measurement and sampling

The splat tool takes as input an AIX trace log file or (for an SMP trace) a set of log files, and preferably a names file produced by the gennames or gensyms command.

The procedure for generating these files is shown in the trace section. When you run trace, you will usually use the flag -J splat to capture the events analyzed by splat (or without the -J flag, to capture all events). The significant trace hooks are shown in the following table:

Hook ID

  • 106 HKWD_KERN_DISPATCH — The thread is dispatched from the run queue to a processor.
  • 10C HKWD_KERN_IDLE — The idle process is been dispatched.
  • 10E HKWD_KERN_RELOCK — One thread is suspended while another is dispatched; the ownership of a RunQ lock is transferred from the first to the second.
  • 112 HKWD_KERN_LOCK — The thread attempts to secure a kernel lock; the sub-hook shows what happened.
  • 113 HKWD_KERN_UNLOCK — A kernel lock is released.
  • 134 HKWD_SYSC_EXECVE — An exec supervisor call (SVC) has been issued by a (forked) process.
  • 139 HKWD_SYSC_FORK — A fork SVC has been issued by a process.
  • 419 HKWD_CPU_PREEMPT — A process has been preempted.
  • 465 HKWD_SYSC_CRTHREAD — A thread_create SVC has been issued by a process.
  • 46D HKWD_KERN_WAITLOCK — The thread is enqueued to wait on a kernel lock.
  • 46E HKWD_KERN_WAKEUPLOCK — A thread has been awakened.
  • 606 HKWD_PTHREAD_COND — Operations on a Condition Variable.
  • 607 HKWD_PTHREAD_MUTEX — Operations on a Mutex.
  • 608 HKWD_PTHREAD_RWLOCK — Operations on a Read/Write Lock.
  • 609 HKWD_PTHREAD_GENERAL — Operations on a PThread.

실행 구간, trace 구간, 분석 구간

작업 부하의 실행 전체를 trace로 잡을 때도 있고, 실행 중 한 구간만 잡을 때도 있습니다.

실행 구간은 작업 부하가 실행되는 전체 시간입니다. 계속 도는 서버 작업 부하라면 얼마든지 길 수 있습니다. trace 구간은 trace가 trace 로그 파일에 실제로 잡은 시간이며, 파일 시스템에 들어갈 수 있는 trace 로그 파일 크기에 따라 길이가 제한됩니다.

분석 구간은 trace 구간 가운데 splat 명령이 분석하는 부분입니다. -t와 -T 플래그는 trace의 첫 이벤트에서 몇 초 뒤에 분석을 시작하고 끝낼지 지정합니다. 기본으로는 trace 전체를 분석하므로 분석 구간이 trace 구간과 같습니다.

참고: splat 명령은 최적화를 위해 분석을 마치면 trace 읽기를 멈추므로, 실제로는 그렇지 않더라도 trace 구간과 분석 구간이 같은 때에 끝났다고 보여 줍니다.

잠금 활동이 계산에 주는 영향을 가장 정확하게 추정하려면 보통 trace 구간을 될 수 있는 대로 길게 잡고 그 구간 전체를 splat으로 분석합니다. -t와 -T는 주로 trace의 몇 이벤트에서 splat이 어떻게 동작하는지 살피는 디버깅 용도로 씁니다.

원칙적으로, trace를 수집할 때 버퍼를 크게 잡거나, splat 실행에 필요한 이벤트만 잡도록 제한합니다.

영어 원문

Execution, trace, and analysis Intervals

In some cases, you can use the trace tool to capture the entire execution of a workload, while in other cases you will capture only an interval of the execution.

The execution interval is the entire time that a workload runs. This interval is arbitrarily long for server workloads that run continuously. The trace interval is the time actually captured in the trace log file by trace. The length of this trace interval is limited by how large a trace log file will fit on the file system.

In contrast, the analysis interval is the portion of the trace interval that is analyzed by the splat command. The -t and -T flags indicate to the splat command to start and finish analysis some number of seconds after the first event in the trace. By default, the splat command analyzes the entire trace, so this analysis interval is the same as the trace interval.

Note: As an optimization, the splat command stops reading the trace when it finishes its analysis, so it indicates that the trace and analysis intervals end at the same time even if they do not.

To most accurately estimate the effect of lock activity on the computation, you will usually want to capture the longest trace interval that you can, and analyze that entire interval with the splat command. The -t and -T flags are usually used for debugging purposes to study the behavior of the splat command across a few events in the trace.

As a rule, either use large buffers when collecting a trace, or limit the captured events to the ones you need to run the splat command.

trace의 끊김

splat 명령은 trace의 이벤트로 원래 시스템의 스레드와 잠금 활동을 재구성합니다.

trace의 일부가 빠지는 경우는 다음과 같습니다.

  • trace를 한때 멈췄다가 나중에 다시 시작했습니다.
  • 한 프로세서의 trace 버퍼가 가득 차서 trace를 멈췄지만 다른 프로세서는 계속 trace했습니다.
  • trace 버퍼의 이벤트 레코드가 trace 로그 파일에 복사되기 전에 덮어써졌습니다.

이런 경우 splat은 trace 구간 전체의 이벤트를 올바르게 분석할 수 없습니다. splat은 trace에서 처음 끊긴 곳에서 분석을 마치고 경고 메시지를 내고 보고서를 만듭니다. 앞의 두 경우의 메시지는 다음과 같습니다.

text
TRACE OFF record read at 0.567201 seconds. One or more of the CPUs has
stopped tracing. You might want to generate a longer trace using larger
buffers and re-run splat.

세 번째 경우의 메시지는 다음과 같습니다.

text
TRACEBUFFER WRAPAROUND record read at 0.567201 seconds. The input trace
has some records missing; splat finishes analyzing at this point. You
might want to re-generate the trace using larger buffers and re-run splat.

AIX 커널이나 PThread 라이브러리의 버전에 따라 계측이 덜 되어 있어 trace에 이벤트가 빠질 수 있습니다. 그러면 splat의 결과가 정확하지 않을 수 있습니다.

영어 원문

Trace discontinuities

The splat command uses the events in the trace to reconstruct the activities of threads and locks in the original system.

If part of the trace is missing, it is because one of the following situations exists:

  • Tracing was stopped at one point and restarted at a later point.

  • One processor fills its trace buffer and stops tracing, while other processors continue tracing.

  • Event records in the trace buffer were overwritten before they could be copied into the trace log file.

In any of the above cases, the splat command will not be able to correctly analyze all the events across the trace interval. The policy of splat is to finish its analysis at the first point of discontinuity in the trace, issue a warning message, and generate its report. In the first two cases, the message is as follows:

text
TRACE OFF record read at 0.567201 seconds. One or more of the CPUs has
stopped tracing. You might want to generate a longer trace using larger
buffers and re-run splat.

In the third case, the message is as follows:

text
TRACEBUFFER WRAPAROUND record read at 0.567201 seconds. The input trace
has some records missing; splat finishes analyzing at this point. You
might want to re-generate the trace using larger buffers and re-run splat.

Some versions of the AIX kernel or PThread library might be incompletely instrumented, so the traces will be missing events. The splat command might not provide correct results in this case.

splat 명령의 주소-이름 변환

잠금 이벤트마다 정보를 잡는 것은 커널과 PThread 라이브러리의 잠금 계측 코드입니다.

잠금은 데이터 주소로, 실행 지점은 명령어 주소로 식별합니다. 이 주소들이 trace의 이벤트 레코드에 담기고, splat 명령은 이것으로 잠금과 잠금을 다루는 함수를 식별합니다.

그러나 프로그래머에게 주소는 쓸모가 적습니다. 프로그램 소스 파일에서 찾을 수 있도록 잠금과 함수 선언의 이름을 알고 싶어 합니다. 이름과 주소의 대응은 컴파일러와 로더가 정하며, gensyms 명령으로 파일에 담을 수 있습니다. gensyms는 커널 잠금 클래스를 선언한 /usr/include/sys/lockname.h 파일의 내용도 담습니다.

gensyms 출력 파일은 -n 플래그로 splat에 넘깁니다. splat은 커널 잠금을 보고할 때 될 수 있는 대로 잘 식별해 보여 줍니다.

선언된 커널 잠금은 이름으로 바뀝니다. 동적으로 만든 잠금은 만들 때 클래스 이름을 주었으면 클래스로 식별합니다. libpthreads.a의 계측 코드는 PThread 동기화 객체의 이름이나 클래스를 잡지 못하므로 이것들은 늘 주소로만 식별됩니다.

영어 원문

Address-to-Name resolution in the splat command

The lock instrumentation in the kernel and PThread library is what captures the information for each lock event.

Data addresses are used to identify locks; instruction addresses are used to identify the point of execution. These addresses are captured in the event records in the trace, and used by the splatcommand to identify the locks and the functions that operate on them.

However, these addresses are not of much use to the programmer, who would rather know the names of the lock and function declarations so that they can be located in the program source files. The conversion of names to addresses is determined by the compiler and loader, and can be captured in a file using the gensyms command. The gensyms command also captures the contents of the /usr/include/sys/ lockname.h file, which declares classes of kernel locks.

The gensyms output file is passed to the splat command with the -n flag. When splat reports on a kernel lock, it provides the best identification that it can.

Kernel locks that are declared are resolved by name. Locks that are created dynamically are identified by class if their class name is given when they are created. The libpthreads.a instrumentation is not equipped to capture names or classes of PThread synchronizers, so they are always identified by address only.

보고서의 예

splat 명령의 보고서는 실행 요약, 전체 잠금 요약, 잠금별 요약으로 이루어지고, 이어서 잠금 상세 보고서 목록이 나옵니다. 잠금 상세 보고서에는 선택에 따라 함수 상세나 스레드 상세 보고서가 들어갑니다.

영어 원문

Examples of generated reports

The report generated by the splat command consists of an execution summary, a gross lock summary, and a per-lock summary, followed by a list of lock detail reports that optionally includes a function detail or a thread detail report.

실행 요약

실행 요약 보고서는 splat 명령을 쓰면 기본으로 만들어집니다.

실행 요약의 예입니다.

text
*****************************************************************************************
splat Cmd: splat -p -sa -da -S100 -i trace.cooked -n gensyms -o splat.out
Trace Cmd:   trace -C all -aj 600,603,605,606,607,608,609 -T 20000000 -L 200000000 -o CONDVAR.raw
Trace Host:  darkwing (0054451E4C00) AIX 5.2
Trace Date:  Thu Sep 27 11:26:16 2002
PURR was used to calculate CPU times.
Elapsed Real Time:        0.098167
Number of CPUs Traced:    1            (Observed):0
Cumulative CPU Time:      0.098167
                                                       start                    stop
                                            --------------------    --------------------
trace interval     (absolute tics)                    967436752               969072535
                   (relative tics)                            0                 1635783
                   (absolute secs)                    58.057947               58.156114
                   (relative secs)                     0.000000                0.098167
analysis interval  (absolute tics)                    967436752               969072535
                   (trace-relative tics)                      0                 1635783
                   (self-relative tics)                       0                 1635783
                   (absolute secs)                    58.057947               58.156114
                   (trace-relative secs)               0.000000                0.098167
                   (self-relative secs)                0.000000                0.098167
**************************************************************************************

위 예에서 보듯 실행 요약은 다음으로 이루어집니다.

  • splat의 버전과 빌드 정보, 면책 조항, 저작권 표시
  • splat을 실행한 명령
  • trace를 수집한 trace 명령
  • trace를 뜬 호스트
  • trace를 뜬 날짜
  • CPU 시간 계산에 PURR 레지스터를 썼는지 밝히는 문장
  • trace의 실제 시간 길이(초)
  • trace에서 관찰된 최대 프로세서 수(trace 조건 정보에 적힌 수와 splat 명령줄에 지정한 수)
  • 누적 프로세서 시간. trace 길이(초)에 프로세서 수를 곱한 값으로, 소비된 프로세서 시간의 전체 초 수를 나타냅니다.
  • trace 구간의 시작·끝 시각을 담은 표. tic과 초 단위로, trace 레코드의 절대 시각과 trace 첫 이벤트 기준 상대 시각을 보여 줍니다.
  • 분석 구간의 시작·끝 시각. tic과 초 단위로, 절대 시각과 trace 구간 시작 기준·분석 구간 시작 기준 상대 시각을 보여 줍니다.
영어 원문

Execution summary

The execution summary report is generated by default when you use the splat command.

The following example shows a sample of the execution summary.

(22줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

From the example above, you can see that the execution summary consists of the following elements:

  • The splat version and build information, disclaimer, and copyright notice.

  • The command used to run splat.

  • The trace command used to collect the trace.

  • The host on which the trace was taken.

  • The date that the trace was taken.

  • A sentence specifying whether the PURR register was used to calculate CPU times.

  • The real-time duration of the trace, expressed in seconds.

  • The maximum number of processors that were observed in the trace (the number specified in the trace conditions information, and the number specified on the splat command line).

  • The cumulative processor time, equal to the duration of the trace in seconds times the number of processors that represents the total number of seconds of processor time consumed.

  • A table containing the start and stop times of the trace interval, measured in tics and seconds, as absolute timestamps, from the trace records, as well as relative to the first event in the trace

  • The start and stop times of the analysis interval, measured in tics and seconds, as absolute timestamps, as well as relative to the beginning of the trace interval and the beginning of the analysis interval.

전체 잠금 요약(Gross lock summary)

전체 잠금 요약 보고서는 splat 명령을 쓰면 기본으로 만들어집니다.

전체 잠금 요약 보고서의 예입니다.

text
***************************************************************************************
                            Unique       Acquisitions     Acq. or Passes   Total System
                     Total  Addresses     (or Passes)         per Second    Spin   Time
                 ---------  ---------    ------------     --------------   ------------
AIX (all) Locks:       523        523         1323045         72175.7768       0.003986
            RunQ:        2          2          487178         26576.9121       0.000000
          Simple:      480        480          824898         45000.4754       0.003986
     Transformed:       22         18             234           352.3452
          Krlock:       50         21           76876            32.6548       0.000458
         Complex:       41         41           10969           598.3894       0.000000
 PThread CondVar:        7          6          160623          8762.4305       0.000000
           Mutex:      128        116         1927771        105165.2585      10.280745 *
          RWLock:        0          0               0             0.0000       0.000000
 ( spin time goal )
***************************************************************************************

표의 열은 다음과 같습니다.

열 설명
Total AIX 커널 잠금의 수와 종류별(RunQ, Simple, Complex) 수. 잠금의 활동이 너무 적어 종류를 구별하지 못하면 RunQ·Simple·Complex의 합보다 클 수 있습니다. 이어서 PThread 조건 변수, PThread 뮤텍스, PThread 읽기/쓰기 잠금의 수가 나옵니다. Transformed 값은 Krlock을 하나 이상 할당(하고 해제)한 서로 다른 simple 잠금의 수입니다. 이때 같은 때에 만들어지지 않았거나 주소가 다르면 서로 다른 simple 잠금으로 봅니다.
Unique Addresses 동기화 객체 종류마다 관찰된 서로 다른 주소의 수. 잠금이 없어졌다가 같은 주소에 다시 만들어질 수 있는데, 쓰임이 다를 수 있으므로 splat은 인스턴스마다 따로 잠금 상세 보고서를 만듭니다. Transformed 값은 Krlock을 하나 이상 할당(하고 해제)한 서로 다른 simple 잠금의 수이며, 다른 때에 같은 주소로 만들어진 simple 잠금은 한 번만 셉니다.
Acquisitions (or Passes) 잠금은 분석 구간 동안 얻은 전체 횟수, PThread 조건 변수는 분석 구간 동안 조건이 통과된 전체 횟수. Transformed 값은 해당 Krlock을 가진 스레드가 얻은 횟수입니다.
Acq. or Passes (per Second) 초당 획득·통과 횟수. 전체 획득·통과 횟수를 trace의 실제 경과 시간으로 나눈 값입니다. Transformed 값은 해당 Krlock을 가진 스레드의 획득률입니다.
% Total System spin Time 동기화 객체 종류마다 스핀에 쓴 누적 시간을 누적 프로세서 시간으로 나눈 백분율. 일반적인 목표는 프로세서 시간의 10% 미만이며 표 아래에 그런 안내가 나옵니다. 10%를 넘는 값에는 별표(*)가 붙습니다. simple 잠금에는 Krlock의 스핀 시간이 포함됩니다.
영어 원문

Gross lock summary

The gross lock summary report is generated by default when you use the splat command.

The following example shows a sample of the gross lock summary report.

(15줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The gross lock summary report table consists of the following columns:

  • Total — The number of AIX Kernel locks, followed by the number of each type of AIX Kernel lock; RunQ, Simple, and Complex. Under some conditions, this will be larger than the sum of the numbers of RunQ, Simple, and Complex locks because we might not observe enough activity on a lock to differentiate its type. This is followed by the number of PThread condition-variables, the number of PThread Mutexes, and the number of PThread Read/Write. The Transformed value represents the number of different simple locks responsible for the allocation (and liberation) of at least one Krlock. In this case, two simple locks will be different if they are not created at the same time or they do not have the same address.
  • Unique Addresses — The number of unique addresses observed for each synchronizer type. Under some conditions, a lock will be destroyed and re-created at the same address; the splat command produces a separate lock detail report for each instance because the usage might be different. The Transformed value represents the number of different simple locks responsible for the allocation (and liberation) of at least one Krlock. In this case, simple locks created at different times but with the same address increment the counter only once.
  • Acquisitions (or Passes) — For locks, the total number of times acquired during the analysis interval; for PThread condition-variables, the total number of times the condition passed during the analysis interval. The Transformed value represents the number of acquisitions made by a thread holding the corresponding Krlock.
  • Acq. or Passes (per Second) — Acquisitions or passes per second, which is the total number of acquisitions or passes divided by the elapsed real time of the trace. The Transformed value represents the acquisition rate for the acquisitions made by threads holding the corresponding krlock.
  • % Total System spin Time — The cumulative time spent spinning on each synchronizer type, divided by the cumulative processor time, times 100 percent. The general goal is to spin for less than 10 percent of the processor time; a message to this effect is printed at the bottom of the table. If any of the entries in this column exceed 10 percent, they are marked with an asterisk (*). For simple locks, the spin time of the Krlocks is included.

잠금별 요약(Per-lock summary)

잠금별 요약 보고서는 splat 명령을 쓰면 기본으로 만들어집니다.

잠금별 요약 보고서의 예입니다.

text
*********************************************************************************************************
100 max entries, Summary sorted by Acquisitions:
                        T Acqui-        Wait
                        y sitions        or                      Locks or      Percent Holdtime
Lock Names,             p or           Trans-                     Passes   Real     Real     Comb
Class, or Address       e Passes Spins  form    %Miss   %Total   / CSec    CPU      Elapse   Spin
**********************  * ****** ***** ****     *****   ******  *********  *******  ******   *******
PROC_INT_CLASS.0003     Q 486490 0     0        0.0000  36.7705 26539.380  5.3532  100.000   0.0000
THREAD_LOCK_CLASS.0012  S 323277 0     9468     0.0000  24.4343 17635.658  6.8216    6.8216  0.0000
THREAD_LOCK_CLASS.0118  D 323094 0     4568     0.0000  24.4205 17625.674  6.7887    6.7887  0.0000
ELIST_CLASS.003C        S 80453  0     201      0.0000  6.0809   4388.934  1.0564    1.0564  0.0000
ELIST_CLASS.0044        S 80419  0     110      0.0000  6.0783   4387.080  1.1299    1.1299  0.0000
tod_lock                C 10229  0     0        0.0000  0.7731    558.020  0.2212    0.2212  0.0000
LDATA_CONTROL_LOCK.0000 D 1833   0     10       0.0000  0.1385     99.995  0.0204    0.0204  0.0000
U_TIMER_CLASS.0014      S 1514   0     23       0.0000  0.1144     82.593  0.0536    0.0536  0.0000
( ... lines omitted ... )
000000002FF22B70        L 368838 0     N/A      0.0000  100.000    9622.964 99.9865  99.9865  0.0000
00000000F00C3D74        M 160625 0     0        0.0000   14.2831   8762.540 99.7702  99.7702  0.0000
00000000200017E8        M 160625 175   0        0.1088   14.2831   8762.540 42.9371  42.9371  0.1487
0000000020001820        V 160623 0     624      0.0000  100.000    1271.728  N/A       N/A     N/A
00000000F00C3750        M     37 0     0        0.0000    0.0033      2.018  0.0037   0.0037  0.0000
00000000F00C3800        M     30 0     0        0.0000    0.0027      1.637  0.0698   0.0698  0.0000
 ( ... lines omitted ... )
************************************************************************************************

첫 줄은 -S 100 플래그로 지정한 보고할 잠금의 최대 수입니다(이 경우 100이지만 여기서는 14개만 보였습니다). 또 -sa 플래그로 지정한 대로 전체 획득·통과 횟수로 정렬했다고 알려 줍니다. 이 보고서에서 커널 잠금과 PThread 동기화 객체는 별개의 목록으로 다루므로, 획득 횟수로 정렬한 상위 커널 잠금 100개에 이어 획득·통과 횟수로 정렬한 상위 PThread 동기화 객체 100개가 나옵니다.

표의 열은 다음과 같습니다.

열 설명
Lock Names, Class, or Address 잠금의 이름, 클래스, 또는 주소. splat이 이름 파일로 주소를 이름에 대응시켰는지에 따라 다릅니다.
Type 잠금 종류. Q RunQ 잠금, S 인터럽트가 켜진(enabled) simple 커널 잠금, D 인터럽트가 꺼진(disabled) simple 커널 잠금, C complex 커널 잠금, M PThread 뮤텍스, V PThread 조건 변수, L PThread 읽기/쓰기 잠금
Acquisitions or Passes 분석 구간 동안 잠금을 얻거나 조건이 통과된 횟수
Spins 분석 구간 동안 잠금(또는 조건 변수)에서 스핀한 횟수
Wait or Transform 분석 구간 동안 그 잠금이나 조건 변수 때문에 스레드가 대기 상태가 된 횟수. Krlock이 켜져 있으면 simple 잠금은 대기 상태가 되지 않으므로, 이 값은 simple 잠금이 할당한 Krlock 수, 곧 simple 잠금의 변환(transform) 횟수입니다.
%Miss 획득·통과에 성공하지 못하고 스핀한 접근 시도의 백분율
%Total 이 종류의 모든 잠금 획득 가운데 이 잠금의 획득이 차지하는 백분율. 이 계산에서 AIX 잠금(RunQ, simple, complex)은 모두 같은 종류로 봅니다. PThread 뮤텍스, 조건 변수, 읽기/쓰기 잠금은 각각 다른 종류입니다.
Locks or Passes / CSec 잠금(또는 조건 변수)을 얻은(통과한) 횟수를 누적 프로세서 시간으로 나눈 값. 잠금 획득 빈도를 나타냅니다.
Percent Holdtime: Real CPU 실행 중이든 중단되었든 어떤 스레드가 잠금을 가지고 있던 시간이 누적 프로세서 시간에서 차지하는 백분율. 조건 변수는 소유하는 것이 아니므로 해당하지 않습니다.
Percent Holdtime: Real Elapse 실행 중이든 중단되었든 어떤 스레드가 잠금을 가지고 있던 시간이 실제 경과 시간에서 차지하는 백분율. 조건 변수에는 해당하지 않습니다.
Percent Holdtime: Comb Spin 실행 중인 스레드가 그 잠금에서 스핀한 시간이 누적 프로세서 시간에서 차지하는 백분율. PThread 라이브러리는 조건 변수에서 대기를 쓰므로 실제로 스핀하는 시간은 없습니다.
영어 원문

Per-lock summary

The pre-locl summary report is generated by default when you use the splat command.

The following example shows a sample of the per-lock summary report.

(24줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The first line indicates the maximum number of locks to report (100 in this case, but we show only 14 of the entries here) as specified by the -S 100 flag. The report also indicates that the entries are sorted by the total number of acquisitions or passes, as specified by the -sa flag. The various Kernel locks and PThread

synchronizers are treated as two separate lists in this report, so the report would produce the top 100 Kernel locks sorted by acquisitions, followed by the top 100 PThread synchronizers sorted by acquisitions or passes.

The per-lock summary table consists of the following columns:

  • Lock Names, Class, or Address — The name, class, or address of the lock, depending on whether the splat command could map the address from a name file.
  • Type — The type of the lock, identified by one of the following letters: Q A RunQ lock S An enabled simple kernel lock D A disabled simple kernel lock C A complex kernel lock M A PThread mutex V A PThread condition-variable L A PThread read/write lock
  • Acquisitions or Passes — The number of times that the lock was acquired or the condition passed, during the analysis interval.
  • Spins — The number of times that the lock (or condition-variable) was spun on during the analysis interval.
  • Wait or Transform — The number of times that a thread was driven into a wait state for that lock or condition-variable during the analysis interval. When Krlocks are enabled, a simple lock never enters the wait state and this value represents the number of Krlocks that the simple lock has allocated, which is the transform count of simple locks.
  • %Miss — The percentage of access attempts that resulted in a spin as opposed to a successful acquisition or pass.
  • %Total — The percentage of all acquisitions that were made to this lock, out of all acquisitions to all locks of this type. All AIX locks (RunQ, simple, and complex) are treated as being the same type for this calculation. The PThread synchronizers mutex, condition-variable, and read/write lock are all distinct types.
  • Locks or Passes / CSec — The number of times that the lock (or condition-variable) was acquired (or passed) divided by the cumulative processor time. This is a measure of the acquisition frequency of the lock.
  • Percent Holdtime
  • Real CPU — The percentage of the cumulative processor time that the lock was held by any thread at all, whether running or suspended. Note that this definition is not applicable to condition-variables because they are not held.
  • Real Elapse — The percentage of the elapsed real time that the lock was held by any thread at all, whether running or suspended. Note that this definition is not applicable to condition-variables because they are not held.
  • Comb Spin — The percentage of the cumulative processor time that executing threads spent spinning on the lock. The PThreads library uses waiting for condition-variables, so there is no time actually spent spinning.

AIX 커널 잠금 상세

splat 명령은 기본으로 요약 보고서의 항목마다 잠금 상세 보고서를 출력합니다. AIX 커널 잠금은 simple이거나 complex입니다.

RunQ 잠금은 simple 잠금의 특별한 경우이지만 쓰이는 방식이 다른 잠금과 크게 다릅니다. splat은 분석하기 쉽도록 RunQ 잠금을 다른 simple 잠금과 구별합니다.

인터럽트가 꺼진 simple 잠금과 RunQ 잠금 상세

AIX SIMPLE 잠금 보고서의 첫 줄은 [AIX SIMPLE Lock]이나 [AIX RunQ lock]으로 시작합니다.

gennames나 gensyms 출력 파일이 있으면 ADDRESS를 잠금 NAME과 CLASS로 바꾸고, 잠금이 든 커널 확장(KEX)도 식별합니다. CLASS 뒤에는 이 클래스의 잠금이 그 전에 몇 개 할당되었는지를 나타내는 16진수 8자리 확장이 붙습니다.

text
[AIX SIMPLE Lock]                 ADDRESS: 0000000020000D60          KEX: unknown
======================================================================================
                        Trans-                            | Percent Held ( 35.568534s )
Type:       Miss  Spin   form   Busy        Secs Held        Real  Real    Comb   Real
Disabled |  Rate  Count  Count  Count  |CPU      Elapsed     CPU  Elapsed  Spin   Wait
         |100.000 1      2658      0   |0.000000 0.000000 |  0.00   0.00   0.00  29.62
--------------------------------------------------------------------------------------
Total Acquisitions:   12945 |SpinQ   Min   Max   Avg  | Krlocks SpinQ Min   Max   Avg
Acq. holding krlock:   2498 |Depth   0     1     0    | Depth         0     1     0
--------------------------------------------------------------------------------------
PROD                              CONFER                        | HANDOFF
0       | SELF:     0     TARGET:     0              ALL:     0 | 0
                   w/ preemption:     0    w/ preemption:     0 |
--------------------------------------------------------------------------------------
                     Lock Activity (mSecs) - Interrupts Disabled
  SIMPLE      Count         Minimum        Maximum        Average          Total
  +++++++     ++++++  ++++++++++++++ ++++++++++++++ ++++++++++++++ ++++++++++++++
  LOCK             0        0.000000       0.000000       0.000000       0.000000
   w/ KRLOCK       0        0.000000       0.000000       0.000000       0.000000
  SPIN             0        0.000000       0.000000       0.000000       0.000000
  KRLOCK LOCK      0        0.000000       0.000000       0.000000       0.000000
  KRLOCK SPIN      0        0.000000       0.000000       0.000000       0.000000
  TRANSFORM        0        0.000000       0.000000       0.000000       0.000000
                Acqui-  Miss  Spin  Transf. Busy    Percent Held of Total Time
Function Name  sitions  Rate  Count  Count  Count    CPU   Elapse  Spin  Transf. Return Address   Start Address    Offset
^^^^^^^^^^^^ ^^^^^^^^  ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^  ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^  ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^
   .dispatch    3177    0.63   20      0      0     0.00    0.02   0.00   0.00   0000000000039CF4 0000000000000000 00039CF4
   .dispatch    6053    0.31   19      0      0     0.03    0.07   0.00   0.00   00000000000398E4 0000000000000000 000398E4
   .setrq       3160    0.19    6      0      0     0.01    0.02   0.00   0.00   0000000000038E60 0000000000000000 00038E60
   .steal_threads  1    0.00    0      0      0     0.00    0.00   0.00   0.00   0000000000066A68 0000000000000000 00066A68
   .steal_threads  6    0.00    0      0      0     0.00    0.00   0.00   0.00   0000000000066CE0 0000000000000000 00066CE0
   .dispatch     535    2.19   12      0     12     0.01    0.02   0.00   0.00   0000000000039D88 0000000000000000 00039D88
   .dispatch       2    0.00    0      0      0     0.00    0.00   0.00   0.00   0000000000039D14 0000000000000000 00039D14
   .prio_requeue   7    0.00    0      0      0     0.00    0.00   0.00   0.00   000000000003B2A4 0000000000000000 0003B2A4
   .setnewrq       4    0.00    0      0      0     0.00    0.00   0.00   0.00   0000000000038980 0000000000000000 00038980
           Acqui-    Miss   Spin  Transf. Busy    Percent Held of Total Time             Process
 ThreadID  sitions   Rate   Count  Count  Count    CPU   Elapse  Spin Transf. ProcessID  Name
 ~~~~~~~~  ~~~~~~~~  ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~  ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~~~~  ~~~~~~~~~~~~~
   775     11548      0.34     39    0      0      0.06   0.10   0.00   0.00     774     wait
 35619         3     25.00      1    0      0      0.00   0.00   0.00   0.00   18392     sleep
 31339        21      4.55      1    0      0      0.00   0.00   0.00   0.00    7364     java
 35621         2      0.00      0    0      0      0.00   0.00   0.00   0.00   18394     locktrace
(... lines omitted ...)

SIMPLE 잠금 보고서의 필드는 다음과 같습니다.

필드 설명
Type simple 잠금을 인터럽트와 함께 썼으면 enabled, 아니면 disabled
Miss Rate 잠금 획득에 실패한 시도의 백분율
Spin Count 잠금 획득에 실패한 시도의 횟수
Busy Count busy를 돌려준 simple_lock_try 호출 횟수
Seconds Held 하위 필드 CPU: 실행 중인 스레드가 잠금을 가지고 있던 프로세서 시간(초)의 합. Elapsed: 실행 중이든 중단되었든 어떤 스레드가 잠금을 가지고 있던 경과 시간(초)의 합
Percent Held 하위 필드 Real CPU: 실행 중인 스레드가 잠금을 가진 시간이 누적 프로세서 시간에서 차지하는 백분율. Real Elapsed: 실행 중이든 중단되었든 어떤 스레드가 잠금을 가진 시간이 실제 경과 시간에서 차지하는 백분율. Comb(ined) Spin: 실행 중인 스레드가 이 잠금을 얻으려고 스핀한 시간이 누적 프로세서 시간에서 차지하는 백분율. Real Wait: 어떤 스레드가 이 잠금을 기다린 시간이 실제 경과 시간에서 차지하는 백분율. 두 스레드 이상이 동시에 기다려도 한 번만 셉니다. 동시에 몇 스레드가 기다렸는지는 WaitQ Depth 통계를 봅니다.
Total Acquisitions 분석 구간 동안 잠금을 얻은 횟수. 성공한 simple_lock_try 호출을 포함합니다.
Acq. holding krlock Krlock을 가진 스레드가 얻은 횟수
Transform count simple 잠금이 쓴(할당하고 해제한) Krlock의 수
SpinQ 분석 구간 동안 실행 중이든 중단되었든 그 잠금에서 스핀한 스레드 수의 최소·최대·평균
Krlocks SpinQ 분석 구간 동안 simple 잠금이 할당한 Krlock에서 스핀한 스레드 수의 최소·최대·평균
PROD 연관된 Krlock의 prod 호출 횟수
CONFER SELF simple 잠금과 연관 Krlock의 자기 자신에게 양보(confer to self) 호출 횟수
CONFER TARGET simple 잠금과 연관 Krlock의 대상에게 양보(confer to target) 호출 횟수
CONFER ALL simple 잠금과 연관 Krlock의 모두에게 양보(confer to all) 호출 횟수
HANDOFF 연관된 Krlock의 handoff 호출 횟수

Lock Activity with Interrupts Enabled (milliseconds)와 Lock Activity with Interrupts Disabled (milliseconds) 절에는 잠금마다 각 잠금 상태에 있었던 시간이 나옵니다.

(주어진 simple 또는 complex 잠금에 대해) 스레드가 있을 수 있는 상태는 다음과 같습니다.

상태 설명
(no lock reference) 스레드가 실행 중이며 이 잠금을 가지고 있지도, 얻으려 하지도 않음
LOCK 스레드가 잠금을 얻어 실행 중
LOCK with KRLOCK 스레드가 연관 Krlock을 가진 채 잠금을 얻어 실행 중
SPIN 스레드가 실행 중이며 잠금을 얻으려다 실패하고 있음
KRLOCK LOCK 스레드가 연관 Krlock을 얻어 실행 중
KRLOCK SPIN 스레드가 실행 중이며 연관 Krlock을 얻으려다 실패하고 있음
TRANSFORM 스레드가 자신과 연관시킬 Krlock을 할당하고 실행 중

보고서의 Lock Activity 절은 각 스레드가 이 잠금에 대해 각 상태에 머문 시간(밀리초)을 잽니다. 열은 스레드가 그 상태에 들어간 횟수, 한 번 들어갔을 때 머문 최대·최소·평균 시간, 모든 스레드가 그 상태에 머문 전체 시간 순입니다. 스레드가 그 상태에 있을 때 인터럽트가 켜져 있었는지 꺼져 있었는지를 구별합니다.

스레드가 분석 구간이 시작되기 전에 잠금을 얻어 분석 구간 동안 풀 수 있습니다. splat은 잠금이 풀리는 것을 보면 그때까지 분석 구간 동안 잠금이 유지되었다고 보고 그 시간을 상태 기계 통계에 넣습니다. 그래서 상태 기계 통계에서 잠금 상태에 들어간 횟수가 분석 구간에서 관찰된 잠금 획득 횟수보다 클 수 있습니다.

RunQ 잠금은 스레드 관리 로직의 자원을 보호하는 데 씁니다. 매우 자주 얻고 매번 아주 짧게만 가집니다. 스레드가 실행 중이 아니어도 RunQ 잠금을 얻거나 풀 수 있습니다. 또 스레드가 RunQ 잠금에서 스핀할 수는 있지만 UNDISP나 WAIT 상태가 되지는 않습니다. RunQ 잠금과 다른 simple 잠금의 통계는 크게 다르게 보입니다.

인터럽트가 켜진 simple 잠금 상세

보고서의 Lock Activity 절은 각 스레드가 이 잠금에 대해 각 상태에 머문 시간(밀리초)을 잽니다. 열은 스레드가 그 상태에 들어간 횟수, 한 번 들어갔을 때 머문 최대·최소·평균 시간, 모든 스레드가 그 상태에 머문 전체 시간 순입니다.

이 절들은 스레드가 그 상태에 있을 때 인터럽트가 켜져 있었는지 꺼져 있었는지를 구별합니다.

다음은 인터럽트가 켜진 simple 잠금 상세 보고서의 예입니다.

text
[AIX SIMPLE Lock]                 CLASS:      PROC_INT_CLASS.00000004
ADDRESS: 000000000200786C
======================================================================================
                                                          | Percent Held ( 26.235284s )
Type        Miss  Spin   Wait   Busy        Secs Held        Real  Real    Comb  Real
Enabled     Rate  Count  Count  Count  |CPU      Elapsed     CPU  Elapsed  Spin  Wait
     0.438 57     2658   12     |0.022852 0.032960 |  0.04   0.13   0.00   0.00
--------------------------------------------------------------------------------------
Total Acquisitions:   2498 |SpinQ   Min   Max   Avg  | WaitQ    Min   Max   Avg
                           |Depth   0     1     0    | Depth   0     0     0
--------------------------------------------------------------------------------------
                      Lock Activity (mSecs) - Interrupts Enabled
  SIMPLE       Count         Minimum        Maximum        Average          Total
  +++++++      ++++++  ++++++++++++++ ++++++++++++++ ++++++++++++++ ++++++++++++++
  LOCK           8027        0.000597       0.022486       0.002847      22.852000
  SPIN             45        0.001376       0.008960       0.004738       0.213212
  UNDISP            0        0.000000       0.000000       0.000000       0.000000
  WAIT              0        0.000000       0.000000       0.000000       0.000000
  PREEMPT        4918        0.000811       0.009728       0.001955       9.615807
                Acqui-  Miss  Spin   Wait   Busy    Percent Held of Total Time
Function Name  sitions  Rate  Count  Count  Count    CPU   Elapse  Spin   Wait   Return Address   Start Address    Offset
^^^^^^^^^^^^ ^^^^^^^^  ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^  ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^
   .dispatch    3177    0.63   20      0      0     0.00    0.02   0.00   0.00  0000000000039CF4 0000000000000000 00039CF4
   .dispatch    6053    0.31   19      0      0     0.03    0.07   0.00   0.00  00000000000398E4 0000000000000000 000398E4
   .setrq       3160    0.19    6      0      0     0.01    0.02   0.00   0.00  0000000000038E60 0000000000000000 00038E60
   .steal_threads  1    0.00    0      0      0     0.00    0.00   0.00   0.00  0000000000066A68 0000000000000000 00066A68
   .steal_threads  6    0.00    0      0      0     0.00    0.00   0.00   0.00  0000000000066CE0 0000000000000000 00066CE0
   .dispatch     535    2.19   12      0     12     0.01    0.02   0.00   0.00  0000000000039D88 0000000000000000 00039D88
   .dispatch       2    0.00    0      0      0     0.00    0.00   0.00   0.00  0000000000039D14 0000000000000000 00039D14
   .prio_requeue   7    0.00    0      0      0     0.00    0.00   0.00   0.00  000000000003B2A4 0000000000000000 0003B2A4
   .setnewrq       4    0.00    0      0      0     0.00    0.00   0.00   0.00  0000000000038980 0000000000000000 00038980
           Acqui-    Miss   Spin   Wait   Busy    Percent Held of Total Time             Process
 ThreadID  sitions   Rate   Count  Count  Count    CPU   Elapse  Spin   Wait  ProcessID  Name
 ~~~~~~~~  ~~~~~~~~  ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~  ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~~~~  ~~~~~~~~~~~~~
   775     11548      0.34     39    0      0      0.06   0.10   0.00   0.00     774     wait
 35619         3     25.00      1    0      0      0.00   0.00   0.00   0.00   18392     sleep
 31339        21      4.55      1    0      0      0.00   0.00   0.00   0.00    7364     java
 35621         2      0.00      0    0      0      0.00   0.00   0.00   0.00   18394     locktrace
(... lines omitted ...)

SIMPLE 잠금 보고서의 필드는 다음과 같습니다.

필드 설명
Type simple 잠금을 인터럽트와 함께 썼으면 enabled, 아니면 disabled
Total Acquisitions 분석 구간 동안 잠금을 얻은 횟수. 성공한 simple_lock_try 호출을 포함합니다.
Miss Rate 잠금 획득에 실패한 시도의 백분율
Spin Count 잠금 획득에 실패한 시도의 횟수
Wait Count 잠금이 풀리기를 기다리며 스레드가 중단된 대기 상태로 들어간 횟수
Busy Count busy를 돌려준 simple_lock_try 호출 횟수
Seconds Held 하위 필드 CPU: 실행 중인 스레드가 잠금을 가지고 있던 프로세서 시간(초)의 합. Elapsed: 실행 중이든 중단되었든 어떤 스레드가 잠금을 가지고 있던 경과 시간(초)의 합
Percent Held 하위 필드 Real CPU, Real Elapsed, Comb(ined) Spin, Real Wait. 뜻은 위의 인터럽트가 꺼진 잠금과 같습니다. 동시에 몇 스레드가 기다렸는지는 WaitQ Depth 통계를 봅니다.
SpinQ 분석 구간 동안 실행 중이든 중단되었든 그 잠금에서 스핀한 스레드 수의 최소·최대·평균
WaitQ 분석 구간 동안 그 잠금을 기다린 스레드 수의 최소·최대·평균

(주어진 simple 또는 complex 잠금에 대해) 스레드가 있을 수 있는 상태는 다음과 같습니다.

상태 설명
(no lock reference) 스레드가 실행 중이며 이 잠금을 가지고 있지도, 얻으려 하지도 않음
LOCK 스레드가 잠금을 얻어 실행 중
SPIN 스레드가 실행 중이며 잠금을 얻으려다 실패하고 있음
UNDISP 스레드가 잠금을 얻으려다 실패하는 동안 디스패치에서 내려옴
WAIT 스레드가 잠금이 풀릴 때까지 중단됨. 그때 바로 잠금을 얻는 것은 아니고 SPIN 상태로 돌아감
PREEMPT 스레드가 이 잠금을 가진 채 디스패치에서 내려옴

스레드가 분석 구간 전에 얻은 잠금을 분석 구간 동안 풀 수 있으므로, 상태 기계 통계에서 잠금 상태에 들어간 횟수가 관찰된 획득 횟수보다 클 수 있습니다(위와 같음).

RunQ 잠금은 매우 자주, 아주 짧게 얻으며 UNDISP나 WAIT 상태가 되지 않으므로 다른 simple 잠금과 통계가 크게 다릅니다(위와 같음).

함수 상세(Function detail)

함수 상세 보고서는 splat의 -df나 -da 옵션으로 얻습니다.

열은 다음과 같습니다.

열 설명
Function Name 이 잠금을 얻었거나 얻으려 한 함수 이름(이름으로 바꿀 수 있으면)
Acquisitions 함수가 이 잠금을 얻은 횟수. complex 잠금과 읽기/쓰기 잠금은 쓰기용 획득(Acquisition Write)과 읽기용 획득(Acquisition Read)을 구별합니다.
Miss Rate 실패한 획득 시도의 백분율
Spin Count 함수가 이 잠금을 얻으려다 실패한 횟수. complex 잠금과 읽기/쓰기 잠금은 Spin Count Write와 Spin Count Read를 구별합니다.
Transf. Count 스레드가 simple 잠금을 얻으려는 동안 simple 잠금이 Krlock을 할당한 횟수
Busy Count simple_lock_try 호출이 busy를 돌려준 횟수
Percent Held of Total Time 하위 필드 CPU: 이 함수 호출로 잠금을 얻은 실행 중인 스레드가 잠금을 가진 시간이 누적 프로세서 시간에서 차지하는 백분율. Elapse(d): 이 함수 호출로 잠금을 얻은 어떤 스레드가(실행 중이든 중단되었든) 잠금을 가진 시간이 실제 경과 시간에서 차지하는 백분율. Spin: 이 함수 호출로 잠금을 얻으려는 실행 중인 스레드가 스핀한 시간이 누적 프로세서 시간에서 차지하는 백분율. Wait: 이 함수 호출로 잠금을 얻으려는 실행 중인 스레드가 기다린 시간이 실제 경과 시간에서 차지하는 백분율
Return Address 이 호출 함수로 돌아갈 주소(16진수)
Start Address 이 호출 함수의 시작 주소(16진수)
Offset 함수 시작 주소에서 돌아갈 주소까지의 거리(16진수)

함수는 splat의 -s 옵션으로 정한 잠금 정렬 기준으로 정렬됩니다. 나열할 함수 수는 -S 매개변수로 정하며 기본은 상위 10개입니다.

스레드 상세(Thread Detail)

스레드 상세 보고서는 splat의 -dt나 -da 옵션으로 얻습니다.

어느 때든 스레드 하나는 실행 중이거나 아니거나 둘 중 하나입니다. 실행 중일 때는 한 프로세서에서만 실행됩니다. 일부 종합 통계는 여러 프로세서에서 동시에 일어날 수 있는 활동을 재므로 누적 프로세서 시간을 기준으로 하며, 그 크기는 시스템의 프로세서 수에 비례할 수 있습니다. 반면 스레드 통계는 대개 실제 경과 시간, 곧 한 프로세서가 처리하는 시간이자 한 스레드가 실행 중이거나 중단된 상태로 보내는 시간을 기준으로 합니다.

스레드 상세 보고서의 열은 다음과 같습니다.

열 설명
ThreadID 스레드 식별자
Acquisitions 이 스레드가 잠금을 얻은 횟수
Miss Rate 이 스레드의 획득 시도 가운데 잠금을 얻지 못한 백분율
Spin Count 이 스레드가 잠금을 얻으려다 실패한 횟수
Transf. Count 스레드가 simple 잠금을 얻으려는 동안 simple 잠금이 Krlock을 할당한 횟수
Wait Count 이 스레드가 잠금이 풀릴 때까지 기다려야 했던 횟수
Busy Count busy를 돌려준 simple_lock_try() 호출 횟수
Percent Held of Total Time 하위 필드 CPU: 이 스레드가 잠금을 가진 채 실행된 시간이 실제 경과 시간에서 차지하는 백분율. Elapse(d): 이 스레드가 실행 중이든 중단되었든 잠금을 가진 시간의 백분율. Spin: 이 스레드가 잠금에서 스핀하며 실행된 시간의 백분율. Wait: 이 스레드가 잠금을 기다린 시간의 백분율
Process ID 프로세스 식별자(simple·complex 잠금 보고서만)
Process Name 잠금을 쓰는 프로세스 이름(simple·complex 잠금 보고서만)

complex 잠금 보고서

AIX complex 잠금은 재귀 잠금, 곧 스레드가 풀기 전에 잠금을 여러 번 얻는 것을 지원하며, 배타적인 쓰기 잠금과 배타적이지 않은 읽기 잠금을 구별합니다.

이 보고서는 [AIX COMPLEX Lock]으로 시작합니다. 대부분의 항목은 simple 잠금 보고서와 같고, 일부는 읽기·쓰기·업그레이드로 나뉩니다. 예를 들어 SpinQ와 WaitQ 통계에는 잠금에서 스핀하거나 기다린 스레드 수의 최소·최대·평균이 들어가고, 읽기용과 쓰기용으로 잠금을 얻으려 한 스레드 수의 최소·최대·평균도 들어갑니다. 읽기용으로는 스레드 몇 개든 잠금을 가질 수 있으므로 잠금을 가진 LockQ의 읽기 스레드 수의 최소·최대·평균도 들어갑니다.

스레드가 쓰기용으로 잠금을 가지면 배타적이어서 다른 스레드는 읽기용으로도 쓰기용으로도 잠금을 얻지 못합니다. 스레드는 쓰기용 잠금을 풀면서 동시에 읽기용으로 얻어 잠금을 다운그레이드할 수 있고, 그러면 다른 스레드도 읽기용으로 잠금을 얻을 수 있습니다. 그 반대가 업그레이드입니다. 스레드가 읽기용으로 잠금을 가지고 있고 다른 스레드는 가지고 있지 않으면, 읽기용 잠금을 풀면서 동시에 쓰기용으로 얻습니다. 업그레이드는 다른 스레드가 읽기 잠금을 풀 때까지 기다려야 할 수 있지만 다운그레이드는 그렇지 않습니다.

스레드는 잠금을 어떤 재귀 깊이까지 얻을 수 있으며, 풀려면 같은 횟수만큼 풀어야 합니다. 라이브러리의 진입점마다 잠금을 얻어야 하는 라이브러리 코드에서 유용합니다. 스레드는 라이브러리에 들어갈 때 한 번 잠금을 얻고, 라이브러리 진입점의 내부 호출은 잠금을 다시 얻었다가 호출에서 돌아올 때 풉니다. 이 잠금을 가진 스레드의 재귀 깊이의 최소·최대·평균이 표에 나옵니다.

재귀 쓰기 잠금을 가진 스레드는 다운그레이드할 수 없습니다. 다운그레이드는 잠금의 마지막 쓰기 획득에만 적용되어야 하고, 앞선 획득은 배타적이어야 할 실제 이유가 있었기 때문입니다. 대신 잠금이 다운그레이드 상태로 표시되며, 이 마지막 획득을 풀거나 업그레이드하면 표시가 지워집니다. 재귀 읽기 잠금을 가진 스레드는 잠금의 마지막 획득만 업그레이드할 수 있고, 그러면 잠금이 업그레이드 상태로 표시됩니다. 스레드는 읽기용으로 잠금을 가진 다른 스레드가 모두 풀 때까지 기다려야 합니다. 업그레이드·다운그레이드 상태로 이 잠금을 가진 스레드의 재귀 깊이의 최소·최대·평균이 표에 나옵니다.

Lock Activity 보고서도 잠금을 무엇을 위해 얻는지(읽기, 쓰기, 업그레이드)에 따라 시간을 나눕니다.

다운그레이드는 경합 없이 이루어지므로 시간이 보고되지 않습니다. 업그레이드 상태는 재귀 읽기 잠금이 업그레이드될 때만 보고되며, 그 밖에는 읽기 잠금을 풀고 쓰기 잠금을 얻는 것으로 잽니다.

함수 상세와 스레드 상세도 획득, 스핀, 대기 횟수를 읽기용과 쓰기용으로 나눕니다.

영어 원문

AIX kernel lock details

By default, the splat command prints a lock detail report for each entry in the summary report. The AIX Kernel locks can be either simple or complex.

The RunQ lock is a special case of the simple lock, although its pattern of usage will differ markedly from other lock types. The splat command distinguishes it from the other simple locks to ease its analysis.

Disabled simple and RunQ lock details

In an AIX SIMPLE Lock report, the first line starts with either [AIX SIMPLE Lock] or [AIX RunQ lock].

If the gennames or gensyms output file permits, the ADDRESS is also converted into a lock NAME and CLASS, and the containing kernel extension (KEX) is identified as well. The CLASS is printed with an eight hex-digit extension indicating how many locks of this class were allocated prior to it.

(43줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The SIMPLE lock report fields are as follows:

  • Type — If the simple lock was used with interrupts, this field is enabled. Otherwise, this field is disabled.
  • Miss Rate — The percentage of attempts that failed to acquire the lock.
  • Spin Count — The number of unsuccessful attempts to acquire the lock.
  • Busy Count — The number of simple_lock_try calls that returned busy.
  • Seconds Held — This field contains the following sub-fields: CPU The total number of processor seconds that the lock was held by an executing thread. Elapsed The total number of elapsed seconds that the lock was held by any thread, whether running or suspended.
  • Percent Held — This field contains the following sub-fields: Real CPU The percentage of the cumulative processor time that the lock was held by an executing thread. Real Elapsed The percentage of the elapsed real time that the lock was held by any thread at all, either running or suspended. Comb(ined) Spin The percentage of the cumulative processor time that running threads spent spinning while trying to acquire this lock. Real Wait The percentage of elapsed real time that any thread was waiting to acquire this lock. If two or more threads are waiting simultaneously, this wait time will only be charged once. To determine how many threads were waiting simultaneously, look at the WaitQ Depth statistics.
  • Total Acquisitions — The number of times that the lock was acquired in the analysis interval. This includes successful simple_lock_try calls.
  • Acq. holding krlock — The number of acquisitions made by threads holding a Krlock.
  • Transform count — The number of Krlocks that have been used (allocated and freed) by the simple lock.
  • SpinQ — The minimum, maximum, and average number of threads spinning on the lock, whether executing or suspended, across the analysis interval.
  • Krlocks SpinQ — The minimum, maximum, and average number of threads spinning on a Krlock allocated by the simple lock, across the analysis interval.
  • PROD — The associated Krlocks prod calls count.
  • CONFER SELF — The confer to self calls count for the simple lock and the associated Krlocks.
  • CONFER TARGET — The confer to target calls count for the simple lock and the associated Krlocks
  • CONFER ALL — The confer to all calls count for the simple lock and the associated Krlocks.
  • HANDOFF — The associated Krlocks handoff calls count.

The Lock Activity with Interrupts Enabled (milliseconds) and Lock Activity with Interrupts Disabled (milliseconds) sections contain information on the time that each lock state is used by the locks.

The states that a thread can be in (with respect to a given simple or complex lock) are as follows:

  • (no lock reference) — The thread is running, does not hold this lock, and is not attempting to acquire this lock.
  • LOCK — The thread has successfully acquired the lock and is currently executing.
  • LOCK with KRLOCK — The thread has successfully acquired the lock, while holding the associated Krlock, and is currently executing.
  • SPIN — The thread is executing and unsuccessfully attempting to acquire the lock.
  • KRLOCK LOCK — The thread has successfully acquired the associated Krlock and is currently executing.
  • KRLOCK SPIN — The thread is executing and unsuccessfully attempting to acquire the associated Krlock.
  • TRANSFORM — The thread has successfully allocated a Krlock that it associates itself to and is executing.

The Lock Activity sections of the report measure the intervals of time (in milliseconds) that each thread spends in each of the states for this lock. The columns report the number of times that a thread entered the given state, followed by the maximum, minimum, and average time that a thread spent in the state once entered, followed by the total time that all threads spent in that state. These sections distinguish whether interrupts were enabled or disabled at the time that the thread was in the given state.

A thread can acquire a lock prior to the beginning of the analysis interval and release the lock during the analysis interval. When the splat command observes the lock being released, it recognizes that the lock had been held during the analysis interval up to that point and counts the time as part of the state-machine statistics. For this reason, the state-machine statistics might report that the number of times that the lock state was entered might actually be larger than the number of acquisitions of the lock that were observed in the analysis interval.

RunQ locks are used to protect resources in the thread management logic. These locks are acquired a large number of times and are only held briefly each time. A thread need not be executing to acquire or release a RunQ lock. Further, a thread might spin on a RunQ lock, but it will not go into an UNDISP or WAIT state on the lock. You will see a dramatic difference between the statistics for RunQ versus other simple locks.

Enabled simple lock details

The Lock Activity sections of the report measure the intervals of time (in milliseconds) that each thread spends in each of the states for this lock. The columns report the number of times that a thread entered the given state, followed by the maximum, minimum, and average time that a thread spent in the state once entered, followed by the total time that all threads spent in that state.

These sections of the report distinguish whether interrupts were enabled or disabled at the time that the thread was in the given state.

The following example is an enabled simple lock detail report:

(39줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The SIMPLE lock report fields are as follows:

  • Type — If the simple lock was used with interrupts, this field is enabled. Otherwise, this field is disabled.
  • Total Acquisitions — The number of times that the lock was acquired in the analysis interval. This includes successful simple_lock_try calls.
  • Miss Rate — The percentage of attempts that failed to acquire the lock.
  • Spin Count — The number of unsuccessful attempts to acquire the lock.
  • Wait Count — The number of times that a thread was forced into a suspended wait state, waiting for the lock to come available.
  • Busy Count — The number of simple_lock_try calls that returned busy.
  • Seconds Held — This field contains the following sub-fields: CPU The total number of processor seconds that the lock was held by an executing thread. Elapsed The total number of elapsed seconds that the lock was held by any thread, whether running or suspended.
  • Percent Held — This field contains the following sub-fields: Real CPU The percentage of the cumulative processor time that the lock was held by an executing thread. Real Elapsed The percentage of the elapsed real time that the lock was held by any thread at all, either running or suspended. Comb(ined) Spin The percentage of the cumulative processor time that running threads spent spinning while trying to acquire this lock. Real Wait The percentage of elapsed real time that any thread was waiting to acquire this lock. If two or more threads are waiting simultaneously, this wait time will only be charged once. To determine how many threads were waiting simultaneously, look at the WaitQ Depth statistics.
  • SpinQ — The minimum, maximum, and average number of threads spinning on the lock, whether executing or suspended, across the analysis interval.
  • WaitQ — The minimum, maximum, and average number of threads waiting on the lock, across the analysis interval.

The Lock Activity with Interrupts Enabled (milliseconds) and Lock Activity with Interrupts Disabled (milliseconds) sections contain information on the time that each lock state is used by the locks.

The states that a thread can be in (with respect to a given simple or complex lock) are as follows:

  • (no lock reference) — The thread is running, does not hold this lock, and is not attempting to acquire this lock.
  • LOCK — The thread has successfully acquired the lock and is currently executing.
  • SPIN — The thread is executing and unsuccessfully attempting to acquire the lock.
  • UNDISP — The thread has become undispatched while unsuccessfully attempting to acquire the lock.
  • WAIT — The thread has been suspended until the lock comes available. It does not necessarily acquire the lock at that time, but instead returns to a SPIN state.
  • PREEMPT — The thread is holding this lock and has become undispatched.

A thread can acquire a lock prior to the beginning of the analysis interval and release the lock during the analysis interval. When the splat command observes the lock being released, it recognizes that the lock had been held during the analysis interval up to that point and counts the time as part of the state-machine statistics. For this reason, the state-machine statistics can report that the number of times that the lock state was entered might actually be larger than the number of acquisitions of the lock that were observed in the analysis interval.

RunQ locks are used to protect resources in the thread management logic. These locks are acquired a large number of times and are only held briefly each time. A thread need not be executing to acquire or

release a RunQ lock. Further, a thread might spin on a RunQ lock, but it will not go into an UNDISP or WAIT state on the lock. You will see a dramatic difference between the statistics for RunQ versus other simple locks.

Function detail

The function detail report is obtained by using the -df or -da options of splat.

The columns are defined as follows:

  • Function Name — The name of the function that acquired or attempted to acquire this lock, if it could be resolved.
  • Acquisitions — The number of times that the function was able to acquire this lock. For complex lock and read/write, there is a distinction between acquisition for writing, Acquisition Write, and for reading, Acquisition Read.
  • Miss Rate — The percentage of acquisition attempts that failed.
  • Spin Count — The number of unsuccessful attempts by the function to acquire this lock. For complex lock and read/write there is a distinction between spin count for writing, Spin Count Write, and for reading, Spin Count Read.
  • Transf. Count — The number of times that a simple lock has allocated a Krlock, while a thread was trying to acquire the simple lock.
  • Busy Count — The number of times simple_lock_try calls returned busy.
  • Percent Held of Total Time — Contains the following sub-fields: CPU Percentage of the cumulative processor time that the lock was held by an executing thread that had acquired the lock through a call to this function. Elapse(d) The percentage of the elapsed real time that the lock was held by any thread at all, whether running or suspended, that had acquired the lock through a call to this function. Spin The percentage of cumulative processor time that executing threads spent spinning on the lock while trying to acquire the lock through a call to this function. Wait The percentage of elapsed real time that executing threads spent waiting for the lock while trying to acquire the lock through a call to this function.
  • Return Address — The return address to this calling function, in hexadecimal.
  • Start Address — The start address to this calling function, in hexadecimal.
  • Offset — The offset from the function start address to the return address, in hexadecimal.

The functions are ordered by the same sorting criterion as the locks, controlled by the -s option of splat. Further, the number of functions listed is controlled by the -S parameter. The default is the top ten functions.

Thread Detail

The Thread Detail report is obtained by using the -dt or -da options of splat.

At any point in time, a single thread is either running or it is not. When a single thread runs, it only runs on one processor. Some of the composite statistics are measured relative to the cumulative processor time when they measure activities that can happen simultaneously on more than one processor, and the magnitude of the measurements can be proportional to the number of processors in the system. In contrast, the thread statistics are generally measured relative to the elapsed real time, which is the amount of time that a single processor spends processing and the amount of time that a single thread spends in an executing or suspended state.

The Thread Detail report columns are defined as follows:

  • ThreadID — The thread identifier.
  • Acquisitions — The number of times that this thread acquired the lock.
  • Miss Rate — The percentage of acquisition attempts by the thread that failed to secure the lock.
  • Spin Count — The number of unsuccessful attempts by this thread to secure the lock.
  • Transf. Count — The number of times that a simple lock has allocated a Krlock, while a thread was trying to acquire the simple lock.
  • Wait Count — The number of times that this thread was forced to wait until the lock came available.
  • Busy Count — The number of simple_lock_try() calls that returned busy.
  • Percent Held of Total Time — Consists of the following sub-fields: CPU The percentage of the elapsed real time that this thread executed while holding the lock. Elapse(d) The percentage of the elapsed real time that this thread held the lock while running or suspended. Spin The percentage of elapsed real time that this thread executed while spinning on the lock. Wait The percentage of elapsed real time that this thread spent waiting on the lock.
  • Process ID — The Process identifier (only for simple and complex lock report).
  • Process Name — Name of the process using the lock (only for simple and complex lock report).

Complex-Lock report

AIX Complex lock supports recursive locking, where a thread can acquire the lock more than once before releasing it, as well as differentiating between write-locking, which is exclusive, from read-locking, which is not exclusive.

This report begins with [AIX COMPLEX Lock]. Most of the entries are identical to the simple lock report, while some of them are differentiated by read/write/upgrade. For example, the SpinQ and WaitQ statistics include the minimum, maximum, and average number of threads spinning or waiting on the lock. They also include the minimum, maximum, and average number of threads attempting to acquire the lock for reading versus writing. Because an arbitrary number of threads can hold the lock for reading, the report includes the minimum, maximum, and average number of readers in the LockQ that holds the lock.

A thread might hold a lock for writing; this is exclusive and prevents any other thread from securing the lock for reading or for writing. The thread downgrades the lock by simultaneously releasing it for writing and acquiring it for reading; this permits other threads to also acquire the lock for reading. The reverse of this operation is an upgrade; if the thread holds the lock for reading and no other thread holds it as well, the thread simultaneously releases the lock for reading and acquires it for writing. The upgrade operation might require that the thread wait until other threads release their read-locks. The downgrade operation does not.

A thread might acquire the lock to some recursive depth; it must release the lock the same number of times to free it. This is useful in library code where a lock must be secured at each entry-point to the library; a thread will secure the lock once as it enters the library, and internal calls to the library entry-points simply re-secure the lock, and release it when returning from the call. The minimum, maximum, and average recursion depths of any thread holding this lock are reported in the table.

A thread holding a recursive write-lock is not permitted to downgrade it because the downgrade is intended to apply to only the last write-acquisition of the lock, and the prior acquisitions had a real reason to keep the acquisition exclusive. Instead, the lock is marked as being in the downgraded state, which is erased when the this latest acquisition is released or upgraded. A thread holding a recursive read-lock can only upgrade the latest acquisition of the lock, in which case the lock is marked as being upgraded. The thread will have to wait until the lock is released by any other threads holding it for reading. The minimum, maximum, and average recursion-depths of any thread holding this lock in an upgraded or downgraded state are reported in the table.

The Lock Activity report also breaks down the time based on what task the lock is being secured for (reading, writing, or upgrading).

No time is reported to perform a downgrade because this is performed without any contention. The upgrade state is only reported for the case where a recursive read-lock is upgraded. Otherwise, the thread activity is measured as releasing a read-lock and acquiring a write-lock.

The function and thread details also break down the acquisition, spin, and wait counts by whether the lock is to be acquired for reading or writing.

PThread 동기화 객체 보고서

splat 명령은 기본으로 요약 보고서의 PThread 항목마다 상세 보고서를 출력합니다. PThread 동기화 객체에는 뮤텍스, 읽기/쓰기 잠금, 조건 변수가 있습니다.

뮤텍스와 읽기/쓰기 잠금은 AIX complex 잠금과 비슷하며 잠금 상세 보고서에서도 닮은 점이 보입니다. 조건 변수는 잠금과 크게 다르고, 그 점이 보고서에도 드러납니다.

PThread 라이브러리의 계측 코드는 동기화 객체의 이름이나 클래스를 주지 않으므로 주소로만 식별할 수 있습니다. 조건에 따라서는 함수 호출 스택의 돌아갈 주소를 잡을 수 있고, 이 주소와 gensyms 출력으로 동기화 객체를 만든 호출 경로를 알아냅니다. 동기화 객체를 만들고 없앤 시각과 그것을 만든 PThread의 ID도 알 수 있는 경우가 있습니다.

뮤텍스 보고서

PThread 뮤텍스는 한 스레드만 잠금을 얻을 수 있다는 점에서 AIX simple 잠금과 비슷하고, 재귀로 가질 수 있다는 점에서 AIX complex 잠금과 비슷합니다.

text
[PThread MUTEX]    ADDRESS:     00000000F0154CD0
Parent Thread:  0000000000000001     creation time:     26.232305
Pid: 18396       Process Name: trcstop
Creation call-chain ==================================================================
00000000D268606C        .pthread_mutex_lock
00000000D268EB88        .pthread_once
00000000D01FE588        .__libs_init
00000000D01EB2FC        ._libc_inline_callbacks
00000000D01EB280        ._libc_declare_data_functions
00000000D269F960        ._pth_init_libc
00000000D268A2B4        .pthread_init
00000000D01EAC08        .__modinit
000000001000014C        .__start
======================================================================================
                                                          | Percent Held ( 26.235284s )
Acqui-      Miss  Spin   Wait   Busy        Secs Held        Real  Real    Comb  Real
sitions     Rate  Count  Count  Count  |CPU      Elapsed     CPU  Elapsed  Spin  Wait
1           0.000 0      0      0      |0.000006 0.000006 |  0.00   0.00   0.00  0.00
--------------------------------------------------------------------------------------
Depth     Min   Max   Avg
SpinQ     0     0     0
WaitQ     0     0     0
Recursion 0     1     0
             Acqui-     Miss  Spin   Wait   Busy        Percent Held of Total Time
 PThreadID   sitions    Rate  Count  Count  Count     CPU     Elapse    Spin     Wait
 ~~~~~~~~~~  ~~~~~~~~  ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~   ~~~~~~   ~~~~~~   ~~~~~~   ~~~~~~
         1         1    0.00      0      0      0     0.00     0.00     0.00     0.00
                    Acqui-   Miss  Spin   Wait   Busy    Percent Held of Total Time
Function Name      sitions   Rate  Count  Count  Count    CPU   Elapse  Spin   Wait   Return Address   Start Address    Offset
^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^  ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^  ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^
   .pthread_once        0    0.00    0      0      0     99.99  99.99   0.00   0.00  00000000D268EC98 00000000D2684180 0000AB18
   .pthread_once        1    0.00    0      0      0      0.01   0.01   0.00   0.00  00000000D268EB88 00000000D2684180 0000AA08

공통 머리글 정보와 [PThread MUTEX] 식별자에 더해 다음 잠금 상세가 나옵니다.

필드 설명
Parent Thread 부모 pthread의 pthread ID
creation time trace에 기록된 첫 이벤트에서 만들어진 때까지의 경과 시간(초, 알 수 있으면)
deletion time trace에 기록된 첫 이벤트에서 없어진 때까지의 경과 시간(초, 알 수 있으면)
PID 프로세스 식별자
Process Name 잠금을 쓰는 프로세스 이름
Call-chain 호출된 메서드의 스택(알 수 있으면)
Acquisitions 분석 구간 동안 잠금을 얻은 횟수
Miss Rate 잠금 획득에 실패한 시도의 백분율
Spin Count 잠금 획득에 실패한 시도의 횟수
Wait Count 잠금이 풀리기를 기다리며 스레드가 중단된 대기 상태로 들어간 횟수
Busy Count busy를 돌려준 trylock 호출 횟수
Seconds Held 하위 필드 CPU: 실행 중인 스레드가 잠금을 가진 프로세서 시간(초)의 합. Elapse(d): 스레드가 실행 중이든 중단되었든 잠금을 가진 경과 시간(초)의 합
Percent Held 하위 필드 Real CPU: 실행 중인 스레드가 잠금을 가진 시간이 누적 프로세서 시간에서 차지하는 백분율. Real Elapsed: 실행 중이든 중단되었든 어떤 스레드가 잠금을 가진 시간이 실제 경과 시간에서 차지하는 백분율. Comb(ined) Spin: 실행 중인 스레드가 이 잠금을 얻으려고 스핀한 시간이 누적 프로세서 시간에서 차지하는 백분율. Real Wait: 어떤 스레드가 이 잠금을 기다린 시간이 실제 경과 시간에서 차지하는 백분율(동시에 기다려도 한 번만 셈. 동시 대기 수는 WaitQ Depth 통계)
Depth 하위 필드 SpinQ: 분석 구간 동안 실행 중이든 중단되었든 잠금에서 스핀한 스레드 수의 최소·최대·평균. WaitQ: 잠금을 기다린 스레드 수의 최소·최대·평균. Recursion: 각 스레드가 잠금을 가진 재귀 깊이의 최소·최대·평균

뮤텍스 pthread 상세

-dt나 -da 옵션을 쓰면 다음 pthread 상세를 보고합니다.

필드 설명
PThreadID PThread 식별자
Acquisitions 이 pthread가 뮤텍스를 얻은 횟수
Miss Rate 이 pthread의 획득 시도 가운데 뮤텍스를 얻지 못한 백분율
Spin Count 이 pthread가 뮤텍스를 얻으려다 실패한 횟수
Wait Count 이 pthread가 뮤텍스가 풀릴 때까지 기다려야 했던 횟수
Busy Count busy를 돌려준 trylock 호출 횟수
Percent Held of Total Time 하위 필드 CPU: 이 pthread가 뮤텍스를 가진 채 실행된 시간이 실제 경과 시간에서 차지하는 백분율. Elapse(d): 실행 중이든 중단되었든 뮤텍스를 가진 시간의 백분율. Spin: 뮤텍스에서 스핀하며 실행된 시간의 백분율. Wait: 뮤텍스를 기다린 시간의 백분율

뮤텍스 함수 상세

-df나 -da 옵션을 쓰면 함수 상세를 보고합니다.

필드 설명
PThreadID PThread 식별자
Acquisitions 이 함수가 뮤텍스를 얻은 횟수
Miss Rate 이 함수의 획득 시도 가운데 뮤텍스를 얻지 못한 백분율
Spin Count 이 함수가 뮤텍스를 얻으려다 실패한 횟수
Wait Count 이 함수가 뮤텍스가 풀릴 때까지 기다려야 했던 횟수
Busy Count busy를 돌려준 trylock 호출 횟수
Percent Held of Total Time 하위 필드 CPU, Elapse(d), Spin, Wait. 뜻은 pthread 상세와 같으며 대상이 이 함수입니다.
Return Address 이 호출 함수로 돌아갈 주소(16진수)
Start Address 이 호출 함수의 시작 주소(16진수)
Offset 함수 시작 주소에서 돌아갈 주소까지의 거리(16진수)

읽기/쓰기 잠금 보고서

PThread 읽기/쓰기 잠금은 읽기용이나 쓰기용으로 얻을 수 있다는 점에서 AIX complex 잠금과 비슷합니다.

쓰기는 배타적이어서 한 스레드만 쓰기용으로 잠금을 얻을 수 있고, 그동안 다른 스레드는 읽기용으로도 쓰기용으로도 가질 수 없습니다. 읽기는 배타적이지 않아 여러 스레드가 읽기용으로 가질 수 있습니다. 읽기는 재귀적이어서 한 스레드가 읽기 획득을 여러 번 가질 수 있습니다. 쓰기는 재귀적이지 않습니다.

text
[PThread RWLock]    ADDRESS:    000000002FF228E0
Parent Thread:  0000000000000001     creation time:     5.236585          deletion time:  6.090511
Pid: 7362        Process Name: /home/testrwlock
Creation call-chain ==================================================================
0000000010000458        .main
00000000100001DC        .__start
=============================================================================
                                                  | Percent Held ( 26.235284s )
Acqui-      Miss  Spin   Wait       Secs Held        Real  Real    Comb  Real
sitions     Rate  Count  Count |CPU      Elapsed     CPU  Elapsed  Spin  Wait
1150     |40.568   785    0    |21.037942 12.0346 |80.19   99.22  30.45 46.29
--------------------------------------------------------------------------------------
                Readers             Writers                     Total
Depth     Min   Max   Avg       Min   Max   Avg            Min   Max   Avg
LockQ     0     2     0         0     1     0              0     2     0
SpinQ     0     768   601       0     15    11             0     782   612
WaitQ     0     769   166       0     15    3              0     783   169
             Acquisitions   Miss   Spin   Count  Wait   Count  Busy    Percent Held of Total Time
PthreadID    Write  Read    Rate   Write  Read   Write  Read   Count    CPU   Elapse  Spin   Wait
 ~~~~~~~~~~  ~~~~~~ ~~~~~~  ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~  ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~
        772       0    207   78.70      0    765      0    796      0   11.58  15.13 29.69  23.21
        515     765      0    1.80     14      0     14      0      0   80.10  80.19 49.76  23.08
        258       0    178    3.26      0      6      0      5      0   12.56  17.10 10.00  20.02
                 Acquisitions   Miss  Spin   Count  Wait   Count  Busy   Percent Held of Total Time
Function Name    Write  Read    Rate  Write  Read   Write  Read   Count  CPU   Elapse  Spin   Wait    Return Address   Start Address    Offset
 ^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^  ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ ^^^^^^  ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
  ._pthread_body  765    385   40.57   14    771      0      0      0   1.55    3.10   1.63   0.00  00000000D268944C 00000000D2684180 000052CC

공통 머리글 정보와 [PThread RWLock] 식별자에 더해 다음 잠금 상세가 나옵니다.

필드 설명
Parent Thread 부모 pthread의 pthread ID
creation time trace 첫 이벤트에서 만들어진 때까지의 경과 시간(초, 알 수 있으면)
deletion time trace 첫 이벤트에서 없어진 때까지의 경과 시간(초, 알 수 있으면)
PID 프로세스 식별자
Process Name 잠금을 쓰는 프로세스 이름
Call-chain 호출된 메서드의 스택(알 수 있으면)
Acquisitions 분석 구간 동안 잠금을 얻은 횟수
Miss Rate 잠금 획득에 실패한 시도의 백분율
Spin Count 잠금 획득에 실패한 시도의 횟수
Wait Count 지금의 PThread 구현은 읽기/쓰기 잠금에서 pthread를 기다리게 하지 않습니다. 이 값은 이 잠금에서 스핀하던 스레드가 디스패치에서 내려온 횟수입니다.
Seconds Held 하위 필드 CPU: 실행 중인 pthread가 잠금을 가진 프로세서 시간(초)의 합. 같은 pthread가 여러 번 가져도 한 구간으로 셉니다. Elapse(d): pthread가 실행 중이든 중단되었든 어떤 pthread가 잠금을 가진 경과 시간(초)의 합
Percent Held 하위 필드 Real CPU: 실행 중인 어떤 pthread가 잠금을 가진 시간이 누적 프로세서 시간에서 차지하는 백분율. Real Elapsed: 실행 중이든 중단되었든 어떤 pthread가 잠금을 가진 시간이 실제 경과 시간에서 차지하는 백분율. Comb(ined) Spin: 실행 중인 pthread가 이 잠금을 얻으려고 스핀한 시간이 누적 프로세서 시간에서 차지하는 백분율. Real Wait: 어떤 pthread가 이 잠금을 기다린 시간이 실제 경과 시간에서 차지하는 백분율(동시에 기다려도 한 번만 셈. 동시 대기 수는 WaitQ Depth 통계)
Depth 하위 필드 LockQ: 분석 구간 동안 실행 중이든 중단되었든 잠금을 가진 pthread 수의 최소·최대·평균. SpinQ: 잠금에서 스핀한 pthread 수의 최소·최대·평균. WaitQ: 잠금을 시간 제한 대기(timed-wait) 상태로 기다린 pthread 수의 최소·최대·평균. 셋 다 읽기 획득, 쓰기 획득, 전체 획득으로 나눕니다.

참고: 읽기/쓰기 잠금의 pthread 상세와 함수 상세는 뮤텍스 상세 보고서와 비슷하며, 획득·스핀·대기 횟수를 읽기용과 쓰기용으로 나눈다는 점만 다릅니다.

조건 변수 보고서

PThread 조건 변수는 동기화 객체이지만 잠금은 아닙니다. 조건이 이제 성립한다는 신호가 올 때까지 PThread가 중단됩니다.

text
[PThread CondVar]    ADDRESS:   0000000020000A18
Parent Thread:  0000000000000001     creation time:     0.216301
Pid: 7360        Process Name: /home/splat/test/condition
Creation call-chain ========================================================
00000000D26A0EE8        .pthread_cond_timedwait
0000000010000510        .main
00000000100001DC        .__start
=========================================================================
                              | Spin / Wait Time ( 26.235284s )
         | Fail  Spin   Wait     Comb    Comb
 Passes  | Rate  Count  Count |  Spin    Wait
 1       |50.000   1      0   | 26.02    0.00
-------------------------------------------------------------------------
Depth     Min   Max   Avg
SpinQ     0     1     1
WaitQ     0     0     0
                       Fail   Spin   Wait    % Total Time
 PThreadID   Passes    Rate   Count  Count   Spin     Wait
 ~~~~~~~~~  ~~~~~~~~  ~~~~~~  ~~~~~~ ~~~~~~  ~~~~~~  ~~~~~~
         1         1  50.0000     1      0  99.1755  0.0000
                                   Fail   Spin   Wait    % Total Time
Function Name   Passes     Rate   Count  Count  Spin     Wait    Return Address   Start Address    Offset
^^^^^^^^^^^^^^^ ^^^^^^^^  ^^^^^^  ^^^^^^ ^^^^^^ ^^^^^^   ^^^^^^  ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^
  .__start       1        50.0000     1     0    99.1755 0.0000  00000000100001DC 0000000010000000 000001DC

공통 머리글 정보와 [PThread CondVar] 식별자에 더해 다음 상세가 나옵니다.

필드 설명
Passes 분석 구간 동안 조건이 성립한다는 신호가 온 횟수
Fail Rate 조건을 검사했는데 참이 아니었던 횟수의 백분율
Spin Count 조건을 검사했는데 참이 아니었던 횟수
Wait Count 조건의 신호를 기다리며 pthread가 중단된 대기 상태로 들어간 횟수
Spin / Wait Time 하위 필드 Comb Spin: pthread가 조건을 기다리며 스핀한 프로세서 시간(초)의 합. Comb Wait: pthread가 조건을 기다리며 대기 상태로 보낸 경과 시간(초)의 합
Depth 하위 필드 SpinQ: 분석 구간 동안 조건을 기다리며 스핀한 pthread 수의 최소·최대·평균. WaitQ: 조건을 기다린 pthread 수의 최소·최대·평균

조건 변수 pthread 상세

-dt나 -da 옵션을 쓰면 다음 pthread 상세를 보고합니다.

필드 설명
PThreadID PThread 식별자
Passes 이 pthread가 조건이 통과했다는 알림을 받은 횟수
Fail Rate 이 pthread가 조건을 검사했는데 참이 아니었던 횟수의 백분율
Spin Count 이 pthread가 조건을 검사했는데 참이 아니었던 횟수
Wait Count 이 pthread가 조건이 참이 될 때까지 기다려야 했던 횟수
Percent Total Time 하위 필드 Spin: 이 pthread가 조건을 검사하며 스핀한 시간이 실제 경과 시간에서 차지하는 백분율. Wait: 조건이 성립하기를 기다린 시간의 백분율

조건 변수 함수 상세

-df나 -da 옵션을 쓰면 다음 함수 상세를 보고합니다.

필드 설명
Function Name 이 조건을 통과했거나 통과하려 한 함수 이름
Passes 이 함수가 조건이 통과했다는 알림을 받은 횟수
Fail Rate 이 함수가 조건을 검사했는데 참이 아니었던 횟수의 백분율
Spin Count 이 함수가 조건을 검사했는데 참이 아니었던 횟수
Wait Count 이 함수가 조건이 참이 될 때까지 기다려야 했던 횟수
Percent Total Time 하위 필드 Spin: 이 함수가 조건을 검사하며 스핀한 시간의 백분율. Wait: 조건이 성립하기를 기다린 시간의 백분율
Return Address 이 호출 함수로 돌아갈 주소(16진수)
Start Address 이 호출 함수의 시작 주소(16진수)
Offset 함수 시작 주소에서 돌아갈 주소까지의 거리(16진수)
영어 원문

PThread synchronizer reports

By default, the splat command prints a detailed report for each PThread entry in the summary report. The PThread synchronizers are of the following types: mutex, read/write lock, and condition-variable.

The mutex and read/write lock are related to the AIX complex lock. You can view the similarities in the lock detail reports. The condition-variable differs significantly from a lock, and this is reflected in the report details.

The PThread library instrumentation does not provide names or classes of synchronizers, so the addresses are the only way we have to identify them. Under certain conditions, the instrumentation can capture the return addresses of the function call stack, and these addresses are used with the gensyms output to identify the call chains when these synchronizers are created. The creation and deletion times of the synchronizer can sometimes be determined as well, along with the ID of the PThread that created them.

Mutex reports

The PThread mutex is similar to an AIX simple lock in that only one thread can acquire the lock, and is like an AIX complex lock in that it can be held recursively.

(32줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

In addition to the common header information and the [PThread MUTEX] identifier, this report lists the following lock details:

  • Parent Thread — Pthread id of the parent pthread.
  • creation time — Elapsed time in seconds after the first event recorded in trace (if available).
  • deletion time — Elapsed time in seconds after the first event recorded in trace (if available).
  • PID — Process identifier.
  • Process Name — Name of the process using the lock.
  • Call-chain — Stack of called methods (if available).
  • Acquisitions — The number of times that the lock was acquired in the analysis interval.
  • Miss Rate — The percentage of attempts that failed to acquire the lock.
  • Spin Count — The number of unsuccessful attempts to acquire the lock.
  • Wait Count — The number of times that a thread was forced into a suspended wait state waiting for the lock to come available.
  • Busy Count — The number of trylock calls that returned busy.
  • Seconds Held — This field contains the following sub-fields: CPU The total number of processor seconds that the lock was held by an executing thread. Elapse(d) The total number of elapsed seconds that the lock was held, whether the thread was running or suspended.
  • Percent Held — This field contains the following sub-fields: Real CPU The percentage of the cumulative processor time that the lock was held by an executing thread. Real Elapsed The percentage of the elapsed real time that the lock was held by any thread, either running or suspended. Comb(ined) Spin The percentage of the cumulative processor time that running threads spent spinning while trying to acquire this lock. Real Wait The percentage of elapsed real time that any thread was waiting to acquire this lock. If two or more threads are waiting simultaneously, this wait time will only be charged once. To learn how many threads were waiting simultaneously, look at the WaitQ Depth statistics.
  • Depth — This field contains the following sub-fields: SpinQ The minimum, maximum, and average number of threads spinning on the lock, whether executing or suspended, across the analysis interval. WaitQ The minimum, maximum, and average number of threads waiting on the lock, across the analysis interval. Recursion The minimum, maximum, and average recursion depth to which each thread held the lock.

Mutex Pthread detail

If the -dt or -da options are used, the splat command reports the following pthread details.

  • PThreadID — The PThread identifier.
  • Acquisitions — The number of times that this pthread acquired the mutex.
  • Miss Rate — The percentage of acquisition attempts by the pthread that failed to secure the mutex.
  • Spin Count — The number of unsuccessful attempts by this pthread to secure the mutex.
  • Wait Count — The number of times that this pthread was forced to wait until the mutex came available.
  • Busy Count — The number of trylock calls that returned busy.
  • Percent Held of Total Time — This field contains the following sub-fields: CPU The percentage of the elapsed real time that this pthread executed while holding the mutex. Elapse(d) The percentage of the elapsed real time that this pthread held the mutex while running or suspended. Spin The percentage of elapsed real time that this pthread executed while spinning on the mutex. Wait The percentage of elapsed real time that this pthread spent waiting on the mutex.

Mutex function detail

If the -df or -da options are used, the splat command reports the function details.

  • PThreadID — The PThread identifier.
  • Acquisitions — The number of times that this function acquired the mutex.
  • Miss Rate — The percentage of acquisition attempts by the function that failed to secure the mutex.
  • Spin Count — The number of unsuccessful attempts by this function to secure the mutex.
  • Wait Count — The number of times that this function was forced to wait until the mutex came available.
  • Busy Count — The number of trylock calls that returned busy.
  • Percent Held of Total Time — This field contains the following sub-fields: CPU The percentage of the elapsed real time that this function executed while holding the mutex. Elapse(d) The percentage of the elapsed real time that this function held the mutex while running or suspended. Spin The percentage of elapsed real time that this function executed while spinning on the mutex. Wait The percentage of elapsed real time that this function spent waiting for the mutex.
  • Return Address — The return address to this calling function, in hexadecimal.
  • Start Address — The start address to this calling function, in hexadecimal.
  • Offset — The offset from the function start address to the return address, in hexadecimal.

Read/Write lock reports

The PThread read/write lock is similar to an AIX complex lock in that it can be acquired for reading or writing.

Writing is exclusive in that a single thread can only acquire the lock for writing, and no other thread can hold the lock for reading or writing at that point. Reading is not exclusive, so more than one thread can hold the lock for reading. Reading is recursive in that a single thread can hold multiple read-acquisitions on the lock. Writing is not recursive.

(27줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

In addition to the common header information and the [PThread RWLock] identifier, this report lists the following lock details:

  • Parent Thread — Pthread id of the parent pthread.
  • creation time — Elapsed time in seconds after the first event recorded in trace (if available).
  • deletion time — Elapsed time in seconds after the first event recorded in trace (if available).
  • PID — Process identifier.
  • Process Name — Name of the process using the lock.
  • Call-chain — Stack of called methods (if available).
  • Acquisitions — The number of times that the lock was acquired in the analysis interval.
  • Miss Rate — The percentage of attempts that failed to acquire the lock.
  • Spin Count — The number of unsuccessful attempts to acquire the lock.
  • Wait Count — The current PThread implementation does not force pthreads to wait for read/write locks. This reports the number of times a thread, spinning on this lock, is undispatched.
  • Seconds Held — This field contains the following sub-fields: CPU The total number of processor seconds that the lock was held by an executing pthread. If the lock is held multiple times by the same pthread, only one hold interval is counted. Elapse(d) The total number of elapsed seconds that the lock was held by any pthread, whether the pthread was running or suspended.
  • Percent Held — This field contains the following sub-fields: Real CPU The percentage of the cumulative processor time that the lock was held by any executing pthread. Real Elapsed The percentage of the elapsed real time that the lock was held by any pthread, either running or suspended. Comb(ined) Spin The percentage of the cumulative processor time that running pthreads spent spinning while trying to acquire this lock. Real Wait The percentage of elapsed real time that any pthread was waiting to acquire this lock. If two or more threads are waiting simultaneously, this wait time will only be charged once. To learn how many pthreads were waiting simultaneously, look at the WaitQ Depth statistics.
  • Depth — This field contains the following sub-fields: LockQ The minimum, maximum, and average number of pthreads holding the lock, whether executing or suspended, across the analysis interval. This is broken down by read-acquisitions, write-acquisitions, and total acquisitions. SpinQ The minimum, maximum, and average number of pthreads spinning on the lock, whether executing or suspended, across the analysis interval. This is broken down by read-acquisitions, write-acquisitions, and total acquisitions. WaitQ The minimum, maximum, and average number of pthreads in a timed-wait state for the lock, across the analysis interval. This is broken down by read-acquisitions, write-acquisitions, and total acquisitions.
  • Note: The pthread and function details for read/write locks are similar to the mutex detail reports,

except that they break down the acquisition, spin, and wait counts by whether the lock is to be acquired for reading or writing.

Condition-Variable report

The PThread condition-variable is a synchronizer, but not a lock. A PThread is suspended until a signal indicates that the condition now holds.

(24줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

In addition to the common header information and the [PThread CondVar] identifier, this report lists the following details:

  • Passes — The number of times that the condition was signaled to hold during the analysis interval.
  • Fail Rate — The percentage of times that the condition was tested and was not found to be true.
  • Spin Count — The number of times that the condition was tested and was not found to be true.
  • Wait Count — The number of times that a pthread was forced into a suspended wait state waiting for the condition to be signaled.
  • Spin / Wait Time — This field contains the following sub-fields: Comb Spin The total number of processor seconds that pthreads spun while waiting for the condition. Comb Wait The total number of elapsed seconds that pthreads spent in a wait state for the condition.
  • Depth — This field contains the following sub-fields: SpinQ The minimum, maximum, and average number of pthreads spinning while waiting for the condition, across the analysis interval. WaitQ The minimum, maximum, and average number of pthreads waiting for the condition, across the analysis interval.

Condition-Variable Pthread detail

If the -dt or -da options are used, the splat command reports the following pthread details.

The pthread details that the splat command reports are:

  • PThreadID — The PThread identifier.
  • Passes — The number of times that this pthread was notified that the condition passed.
  • Fail Rate — The percentage of times that the pthread checked the condition and did not find it to be true.
  • Spin Count — The number of times that the pthread checked the condition and did not find it to be true.
  • Wait Count — The number of times that this pthread was forced to wait until the condition became true.
  • Percent Total Time — This field contains the following sub-fields: Spin The percentage of elapsed real time that this pthread spun while testing the condition. Wait The percentage of elapsed real time that this pthread spent waiting for the condition to hold.

Condition-Variable function detail

If the -df or -da options are used, the splat command reports the following function details.

  • Function Name — The name of the function that passed or attempted to pass this condition.
  • Passes — The number of times that this function was notified that the condition passed.
  • Fail Rate — The percentage of times that the function checked the condition and did not find it to be true.
  • Spin Count — The number of times that the function checked the condition and did not find it to be true.
  • Wait Count — The number of times that this function was forced to wait until the condition became true.
  • Percent Total Time — This field contains the following sub-fields: Spin The percentage of elapsed real time that this function spun while testing the condition. Wait The percentage of elapsed real time that this function spent waiting for the condition to hold.
  • Return Address — The return address to this calling function, in hexadecimal.
  • Start Address — The start address to this calling function, in hexadecimal.
  • Offset — The offset from the function start address to the return address, in hexadecimal.

자주 쓰는 형태

bash
# 잠금 이벤트만 10초 trace -> 이름 파일 -> splat(함수·스레드 상세, 상위 20개)
trace -J splat -a -C all -T 20000000 -L 200000000 -o /tmp/trace.raw
sleep 10; trcstop
trcrpt -C all -r /tmp/trace.raw > /tmp/trace.r
gensyms > /tmp/gensyms.out
splat -i /tmp/trace.r -n /tmp/gensyms.out -o /tmp/splat.out -da -S 20