[AIX 성능 도구 16] Xprofiler (2) 성능 데이터 얻기, 보고서, 코드 보기, 자원 설정

핵심 정리

  • 함수 상자 이름표는 이름 [색인] 자손포함CPU x 자기CPU(요약 모드)이며, 왼쪽 클릭 정보 상자에서 호출 횟수도 봅니다. Function 메뉴의 Statistics Report는 gmon.out 파일마다 평균·표준 편차·최대·최소를 줍니다.
  • Report 메뉴: Flat Profile, Call Graph Profile, Function Index(gprof와 같은 내용)와 Function Call Summary(호출 쌍 순위), Library Statistics(라이브러리별 CPU·호출 비율).
  • File > Save As는 세 보고서를 gprof 출력과 같은 파일로 저장, Save gmon.sum As는 여러 gmon.out의 합(xprofiler -s와 같음), Save/Load Configuration은 보이는 함수 목록을 저장·복원합니다.
  • Show Source Code는 줄마다 틱(0.01초)을, Show Disassembler Code는 명령어마다 틱을 보여 줍니다. 소스 줄 정보는 -g로 컴파일해야 나옵니다.
  • File > Screen Dump로 화면을 PostScript 파일이나 프린터로 보내고, .Xdefaults의 Xprofiler*... 자원 변수로 글꼴·색·창 크기·기본 동작을 바꿉니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (내용이 같음)
원문 Performance Tools Guide and Reference — 5.3판 2장(4570쪽), 6.1판 288313쪽
파일 /usr/lib/X11/app-defaults/Xprofiler, $HOME/.Xdefaults
관련 명령어 xprofiler, gprof, qprt

Xprofiler에서는 여러 수준, 여러 방법으로 응용 프로그램의 성능 데이터를 얻을 수 있습니다. 함수 하나의 데이터를 쉽게 볼 수도 있고, 보고서로 응용 프로그램 전체의 정보를 얻을 수도 있습니다.

기본 데이터 얻기

Xprofiler에서는 함수 호출 트리의 특정 항목에 관한 데이터를 쉽게 얻을 수 있습니다. 관심 있는 항목을 찾은 뒤 여러 방법으로 데이터를 얻습니다. 함수 호출 트리에서 함수를 찾지 못하면 "함수 호출 트리에서 특정 객체 찾기"(Xprofiler (1))를 봅니다.

기본 함수 데이터:

함수 호출 트리의 각 함수 상자에는 기본 성능 데이터를 담은 이름표가 있습니다. 이름표에는 함수 이름, 연관된 순환(cycle, 있으면), 색인이 들어 있습니다. 원문 그림에서 함수 이름은 sub1이고, 순환 1에 속하며, 색인은 5입니다. 함수 호출 트리를 요약 모드로 보는지 평균 모드로 보는지에 따라 이름표 내용이 다릅니다.

요약 모드에서는 이름표에 다음이 들어갑니다.

  • 이 함수가 자기 자신과 자손에 쓴 CPU 시간(초)의 합(x 왼쪽의 수)
  • 이 함수가 자기 자신에만 쓴 CPU 시간(초)(x 오른쪽의 수)

평균 모드에서는 이름표에 다음이 들어갑니다.

  • 모든 입력 gmon.out 파일에서 함수 자체에 쓴 CPU 시간(초)의 평균
  • 모든 입력 gmon.out 파일에서 함수 자체에 쓴 CPU 시간(초)의 표준 편차

요약 모드와 평균 모드는 "함수 호출 트리의 표현 방식 제어하기"(Xprofiler (1))를 봅니다.

창을 완전히 축소하면 이름표가 보이지 않을 수 있으므로 확대해야 합니다. 방법은 아래 "정보 상자"를 봅니다.

기본 호출 데이터:

호출 호 이름표는 각 호출 호 위에 나오며, 두 함수 사이(호출자에서 피호출자로)의 호출 횟수를 나타냅니다. 이름표를 보려면 확대합니다.

기본 클러스터 데이터:

클러스터 상자 이름표는 그 클러스터가 나타내는 라이브러리 이름입니다. 공유 라이브러리면 전체 경로 이름을 보여 줍니다.

정보 상자:

함수 상자, 호출 호, 클러스터 상자마다 이름표와 같은 기본 데이터를 주는 정보 상자가 있습니다. 화면을 완전히 축소해 이름표가 보이지 않을 때 유용합니다. 함수 상자, 호출 호, 클러스터 상자(상자 가장자리에 마우스를 올림)를 왼쪽 단추로 누르면 정보 상자가 나옵니다.

함수의 정보 상자에는 다음이 들어갑니다.

  • 함수 이름, 연관된 순환(있으면), 색인
  • 이 함수가 쓴 CPU 양. 값이 두 개이며, 첫째는 이 함수와 자손에 쓴 CPU 시간, 둘째는 이 함수 자신에만 쓴 CPU 시간입니다.
  • 이 함수가 (자기 자신이나 다른 함수에게) 불린 횟수

호출의 정보 상자에는 다음이 들어갑니다.

  • 호출자와 피호출자 함수의 이름과 색인
  • 호출자가 피호출자를 부른 횟수

클러스터의 정보 상자에는 다음이 들어갑니다.

  • 라이브러리 이름
  • 그 안의 함수가 쓴 전체 CPU 사용량(초)

Function 메뉴의 Statistics Report:

Function 메뉴의 Statistics Report로 함수 하나의 성능 통계, 곧 CPU 사용량과 호출 횟수를 볼 수 있습니다. gmon.out 파일을 둘 이상 쓰면 파일마다 통계를 나눠 보여 줍니다. 이 항목을 고르면 Function Level Statistics Report 창이 나오며 다음 정보를 줍니다.

항목 설명
Function name 고른 함수 이름
Summary Data: CPU Usage 이 함수가 쓴 CPU 시간. 첫째 값은 이 함수와 자손에 쓴 시간, 둘째 값은 자기 자신에만 쓴 시간입니다. gmon.out 파일이 여럿이면 합입니다.
Summary Data: Call Counts 이 함수가 자기 자신을 부른 횟수와 다른 함수에게 불린 횟수의 합
Statistics data: CPU Usage gmon.out 파일마다 나눈 CPU 사용량. Average는 각 파일 데이터의 평균 CPU 시간, Std Dev는 파일 사이 함수별 CPU 사용 표본의 차이(작을수록 작업 부하가 고름), Maximum·Minimum은 모든 파일 가운데 최대·최소 CPU 시간이며 해당 파일 이름이 오른쪽에 나옵니다.
Statistics data: Call Counts gmon.out 파일마다 이 함수가 부르거나 불린 횟수. Average는 파일마다의 평균, Std Dev는 파일 사이 호출 횟수의 차이(작으면 각 파일에서 거의 같은 횟수로 불림), Maximum·Minimum은 한 파일에서의 최대·최소 횟수이며 해당 파일 이름이 오른쪽에 나옵니다.

보고서에서 자세한 데이터 얻기

Xprofiler는 성능 데이터를 텍스트와 표 형식으로, 보고서(report)라는 여러 표로 줍니다. gprof 명령처럼 평면 프로파일(Flat Profile), 호출 그래프 프로파일(Call Graph Profile), 함수 색인(Function Index) 보고서를 만들고, 보고서 두 가지를 더 만듭니다.

Report 메뉴에서 다음 보고서를 볼 수 있습니다.

  • Flat Profile
  • Call Graph Profile
  • Function Index
  • Function Call Summary
  • Library Statistics

보고서 창마다 File 메뉴가 있고, 그 안의 Save As로 보고서를 파일에 저장합니다(아래 "호출 그래프 프로파일, 함수 색인, 평면 프로파일 보고서를 파일로 저장하기" 참고).

참고: Flat Profile, Function Index, Function Call Summary 보고서 창에서 Save As를 고르면, 저장을 마치거나 취소하기 전에는 이 보고서들의 메뉴에서 다른 항목을 고를 수 없습니다. 다만 다른 Xprofiler 메뉴는 쓸 수 있으며, File 메뉴의 Load Files만 계속 비활성입니다.

평면 프로파일 보고서:

Flat Profile을 고르면 Flat Profile 창이 나옵니다. 응용 프로그램 안의 각 함수(공유 라이브러리 호출 포함)의 전체 실행 시간과 호출 횟수를 보여 줍니다. 전체 CPU 사용량에서 차지하는 비율이 가장 큰 함수가 맨 위에 나오고, 나머지는 쓴 시간이 큰 순서로 나옵니다.

-z 플래그를 주지 않으면 CPU 사용량과 호출 횟수가 없는 함수는 들어가지 않습니다. Flat Profile 창의 데이터는 gprof 명령이 만드는 데이터와 같습니다.

Flat Profile 창의 필드는 다음과 같습니다.

필드 설명
%time 프로그램 전체 CPU 사용량 가운데 이 함수가 쓴 비율
cumulative seconds 이 함수와 그 위에 나온 함수들이 쓴 초의 누적 합
self seconds 이 함수만 쓴 초. Xprofiler는 이 값으로 평면 프로파일 보고서의 함수를 정렬합니다.
calls 이 함수가 불린 횟수(이 함수가 프로파일링되었을 때. 아니면 빈칸)
self ms/call 호출당 이 함수에서 쓴 평균 밀리초(프로파일링되었을 때. 아니면 빈칸)
total ms/call 호출당 이 함수와 자손에서 쓴 평균 밀리초(프로파일링되었을 때. 아니면 빈칸)
name 함수 이름. 이름 오른쪽 대괄호([]) 안이 색인입니다. 색인은 Xprofiler 안에서 함수를 식별하며, 함수 호출 트리에서도 해당 함수 아래에 나옵니다.

호출 그래프 프로파일 보고서:

Call Graph Profile을 고르면 응용 프로그램의 함수를 각 함수와 그 자손이 쓴 전체 CPU 사용 비율 순서로 보여 주는 Call Graph Profile 창이 나옵니다. -z 플래그를 주지 않으면 CPU 사용량이 0이고 호출 횟수가 없는 함수는 들어가지 않습니다. 데이터는 gprof 명령이 만드는 데이터와 같습니다.

Call Graph Profile 창의 필드는 다음과 같습니다.

필드 설명
index 호출 그래프 프로파일에서 함수의 색인. 함수를 식별하는 번호이며 함수 호출 트리의 상자 이름표와 다른 보고서에도 같은 색인이 나옵니다.
%time 프로그램 전체 CPU 사용량 가운데 이 함수와 그 자손이 쓴 비율
self 이 함수가 자기 안에서 쓴 초
descendants 이 함수를 위해 그 자손에서 쓴 초
called/total, called+self, called/total 프로그램 안의 여러 종류의 호출을 나타내는 열이며, 오른쪽 name·index·parents·children 열의 함수에 대응합니다. 그 함수가 부모인지, 자식인지, 관심 함수(이 행의 index 필드에 색인이 있는 함수)인지에 따라 부모가 관심 함수를 부른 횟수, 관심 함수가 자기 자신을 재귀로 부른 횟수, 관심 함수가 자식을 부른 횟수를 나타냅니다. 부모 함수의 called/total은 관심 함수를 부른 횟수와 그 부모가 모든 함수를 부른 전체 횟수입니다. called+self는 관심 함수가 자기 자신을 재귀로 부른 횟수입니다.
name, index, parents, children 열 머리의 배치가 정보의 배치를 나타냅니다. 왼쪽이 함수 이름, 오른쪽이 색인이며, 함수 위에 부모가, 아래에 자식이 나옵니다.
name 함수 이름. 순환에 속하면 그 표시도 붙습니다. 관심 함수는 왼쪽에, 부모와 자식 함수는 그 위아래에 들여 써서 나옵니다.
index 호출 그래프 프로파일의 index 열과 함수 호출 트리의 상자 이름표에 나오는 색인
parents 함수의 부모, 곧 관심 함수를 직접 부르는 함수. 응용 프로그램의 일부를 -pg 플래그로 컴파일하지 않으면 그 부분 함수의 부모를 알 수 없어 spontaneous로 나옵니다.
children 함수의 자식, 곧 관심 함수가 직접 부르는 함수

원문 그림에서는 sub2가 관심 함수이고, sub1과 main이 부모, printf와 sub1이 자식입니다.

함수 색인 보고서:

Function Index를 고르면 함수 호출 트리에 든 함수 이름 목록을 알파벳 순서로 보여 주는 Function Index 창이 나옵니다. 각 이름 왼쪽의 대괄호([]) 안이 Xprofiler가 매긴 색인이며, 함수 호출 트리의 상자 이름표와 다른 보고서에도 나옵니다. -z 플래그를 주지 않으면 CPU 사용량과 호출 횟수가 없는 함수는 들어가지 않습니다. Flat Profile처럼 Code Display 메뉴가 있어 소스 코드나 역어셈블 코드를 볼 수 있습니다("코드 보기" 참고).

함수 호출 요약 보고서:

Function Call Summary를 고르면 다른 함수를 부르는 모든 함수를 호출자-피호출자 쌍(함수 호출 트리의 호출 호)으로, 호출 횟수가 큰 순서로 보여 주는 Function Call Summary 창이 나옵니다. 필드는 다음과 같습니다.

필드 설명
%total 전체 호출 수 가운데 이 호출자-피호출자 쌍이 차지하는 비율
calls 이 호출자-피호출자 쌍의 호출 수
function 호출자 함수와 피호출자 함수의 이름

라이브러리 통계 보고서:

Library Statistics를 고르면 응용 프로그램 안의 라이브러리마다 쓴 CPU 시간과 호출 횟수를 보여 주는 Library Statistics 창이 나옵니다. 필드는 다음과 같습니다.

필드 설명
total seconds 라이브러리의 전체 CPU 사용량(초)
%total time 전체 CPU 사용량 가운데 이 라이브러리가 쓴 비율
total calls 이 라이브러리가 만든 전체 호출 수
%total calls 전체 호출 가운데 이 라이브러리가 만든 비율
%calls out of 전체 호출 가운데 이 라이브러리에서 다른 라이브러리로 간 호출의 비율
%calls into 전체 호출 가운데 다른 라이브러리에서 이 라이브러리로 온 호출의 비율
%calls within 전체 호출 가운데 이 라이브러리 안의 함수끼리 한 호출의 비율
load unit 라이브러리의 전체 경로 이름

보고서를 파일로 저장하기:

Report 메뉴로 만든 보고서는 모두 파일로 저장할 수 있습니다. Xprofiler GUI의 File과 Report 메뉴를 씁니다.

보고서 하나 저장하기:

Xprofiler 주 창의 Report 메뉴에서 저장할 보고서를 고릅니다. 보고서 창의 File 메뉴에서 Save As를 고르면 저장 대화상자가 나오며, 이름은 보고서에 따라 붙습니다. 예를 들어 Flat Profile 창에서 고르면 Save Flat Profile Dialog입니다.

호출 그래프 프로파일, 함수 색인, 평면 프로파일 보고서를 파일로 저장하기:

Xprofiler 주 창의 File 메뉴로 세 보고서를 한 파일에 저장할 수 있습니다. 내용은 gprof 명령의 출력과 같습니다. File 메뉴에서 Save As를 고르면 Save File Dialog 창이 나옵니다.

  1. 프로파일링 데이터를 넣을 파일을 지정합니다. 기존 파일이나 새 파일을 지정할 수 있습니다. 기존 파일은 Directories와 Files 선택 상자의 스크롤 막대로 찾고, Filter 단추도 쓸 수 있습니다. 새 파일은 Selection 필드에 이름을 입력합니다.
  2. OK를 누릅니다. 지정한 디렉터리에 지정한 이름으로 프로파일링 데이터가 든 파일이 만들어집니다.

참고: File 메뉴에서 Save As를 골라 Save Profile Reports 창이 열리면, 저장을 마치거나 취소하기 전에는 그 부모 창의 메뉴에서 다른 항목을 고를 수 없습니다. 예를 들어 Flat Profile 보고서에서 Save As를 골라 Save File Dialog 창이 나오면 Flat Profile 창의 다른 항목을 쓸 수 없습니다.

Save File Dialog 창의 File Selection 필드는 Motif 표준을 따릅니다.

여러 프로파일 데이터 파일의 요약 저장하기:

병렬 프로그램을 프로파일링하면 Xprofiler를 시작할 때 프로파일 데이터(gmon.out) 파일을 여럿 지정할 수 있습니다. File 메뉴의 Save gmon.sum As는 이 파일들의 데이터 요약을 한 파일에 저장합니다. xprofiler -s 명령, gprof -s 명령과 결과가 같습니다. 나중에 Xprofiler를 실행할 때 이렇게 만든 파일을 -s 플래그와 함께 입력으로 쓸 수 있습니다. 이렇게 해서 여러 번 실행한 요약 데이터를 쌓을 수 있습니다.

  1. File 메뉴에서 Save gmon.sum As를 고릅니다. Save gmon.sum Dialog 창이 나옵니다.
  2. 요약 데이터를 넣을 파일을 지정합니다. 기본으로 gmon.sum 파일에 넣습니다. 새 파일은 Selection 필드에 이름을 입력하고, 기존 파일은 선택 상자로 찾습니다(Filter 단추도 쓸 수 있음).
  3. OK를 누릅니다. 지정한 디렉터리에 지정한 이름으로 요약 데이터 파일이 만들어집니다.

구성 파일 저장하기:

Save Configuration은 지금 보이는 함수의 이름을 파일에 저장합니다. 같은 세션이나 다른 세션에서 Load Configuration으로 이 구성 파일을 읽을 수 있습니다.

  1. File 메뉴에서 Save Configuration을 고릅니다. Save Configuration File Dialog 창이 나오며 Selection 필드의 기본값은 program.cfg입니다(program은 입력 a.out 파일의 이름). 기본 이름을 쓰거나, 이름을 입력하거나, 목록에서 고릅니다.
  2. Selection 필드에 파일 이름을 지정하고 OK를 누릅니다. 프로그램 이름과 지금 보이는 함수 이름이 든 구성 파일이 만들어집니다.
  3. 기존 파일 이름을 지정하고 OK를 누르면 Overwrite File Dialog 창이 나와 덮어쓰기 전에 확인합니다.

Runtime Options Dialog 창에서 Forced File Overwriting을 골랐으면 Overwrite File Dialog 창이 나오지 않고 경고 없이 덮어씁니다.

구성 파일 적재하기:

Load Configuration은 저장한 구성 파일을 읽어, 구성 파일에 적힌 함수 이름에 따라 함수 호출 트리를 자동으로 다시 구성합니다.

  1. File 메뉴에서 Load Configuration을 고릅니다. Load Configuration File Dialog 창이 열립니다. 현재 세션에서 구성 파일을 적재한 적이 있으면 가장 최근 파일 이름이 Selection 필드에 나옵니다. -c 플래그로도 적재할 수 있습니다.
  2. Files 목록에서 구성 파일을 고르거나 Selection 필드에 이름을 입력하고 OK를 누릅니다. 구성 파일에 적혀 있고 현재 화면의 프로그램 안에서 불리는 함수의 상자만 보이도록 함수 호출 트리를 다시 그리며, 해당 호출 호도 모두 그립니다. 구성 파일의 프로그램(a.out) 이름이 현재 화면의 것과 다르면 그래도 적재할지 묻는 확인 대화상자가 나옵니다.
  3. 구성 파일을 적재한 뒤 함수 호출 트리를 이전 상태로 되돌리려면 Filter 메뉴에서 Undo를 고릅니다.

코드 보기

Xprofiler에서는 함수마다 소스 코드나 역어셈블(disassembler) 코드를 볼 수 있으며, 응용 프로그램이 쓰는 포함된(included) 함수 코드도 볼 수 있습니다. 소스 코드와 포함된 함수 코드는 Source Code 창, 역어셈블 코드는 Disassembler Code 창에서 봅니다. 두 창은 Report 메뉴나 관심 있는 함수의 Function 메뉴로 엽니다.

소스 코드 보기:

Function 메뉴로 Source Code 창을 열려면 관심 있는 함수 상자를 오른쪽 클릭하고 Function 메뉴에서 Show Source Code를 고릅니다.

Report 메뉴로 열려면 다음과 같이 합니다.

  1. Report 메뉴에서 Flat Profile을 고릅니다.
  2. Flat Profile 창에서 볼 함수의 항목을 누릅니다. 항목이 강조 표시됩니다.
  3. Code Display 메뉴에서 Show Source Code를 고릅니다.

Source Code 창 쓰기:

Source Code 창은 Flat Profile 창이나 Function 메뉴에서 지정한 함수의 소스 코드 파일을 보여 줍니다. 필드는 다음과 같습니다.

필드 설명
line 소스 코드 줄 번호
no. ticks per line 틱 하나는 CPU 시간 0.01초입니다. 해당 코드 줄이 쓴 틱 수이며, 예를 들어 3이면 그 문장이 CPU 시간 0.03초를 썼습니다. 응용 프로그램을 -g 플래그로 컴파일했을 때만 값이 나오고, 아니면 빈칸입니다.
source code 응용 프로그램의 소스 코드

Source Code 창의 메뉴는 다음과 같습니다.

  • File: Save As로 주석이 붙은 소스 코드를 파일에 저장합니다. Close로 Source Code 창을 닫습니다.
  • Utility: Show Included Functions 항목이 있습니다. C++ 사용자는 응용 프로그램 소스가 포함하는 포함된 함수 파일의 소스 코드를 볼 수 있습니다.

고른 함수에 연결된 포함된 함수 파일이 없거나, -g 플래그 없이 컴파일해 정보가 없으면 Utility 메뉴가 비활성입니다. Utility 메뉴가 활성이면 고른 함수에 포함된 함수 파일 정보가 있다는 뜻입니다.

Show Included Functions를 고르면 포함된 함수 파일을 모두 나열한 Included Functions Dialog 창이 나옵니다. 목록에서 항목을 왼쪽 클릭하거나 Selection 필드에 파일 이름을 입력하고 OK나 Apply를 누르면, 그 파일의 소스 코드를 보여 주는 Included Function File 창이 나옵니다.

역어셈블 코드 보기:

Function 메뉴로 Disassembler Code 창을 열려면 관심 있는 함수를 오른쪽 클릭하고 Show Disassembler Code를 고릅니다.

Report 메뉴로 열려면 다음과 같이 합니다.

  1. Report 메뉴에서 Flat Profile을 고릅니다.
  2. Flat Profile 창에서 볼 함수의 항목을 누릅니다.
  3. Code Display 메뉴에서 Show Disassembler Code를 고릅니다.

Disassembler Code 창 쓰기:

Disassembler Code 창은 Flat Profile 창에서 지정한 함수의 역어셈블 코드만 보여 줍니다. 필드는 다음과 같습니다.

필드 설명
address 고른 함수의 각 명령어 주소
no. ticks per instr. 틱 하나는 CPU 시간 0.01초입니다. 해당 명령어가 쓴 틱 수이며, 예를 들어 3이면 그 명령어가 CPU 시간 0.03초를 썼습니다.
instruction 실행 명령어
assembler code 실행 명령어에 해당하는 어셈블러 코드
source code 실행 명령어와 어셈블러 코드에 해당하는 소스 코드 줄. -g 플래그로 컴파일해야 나옵니다.

창 아래의 Search Engine 필드로 역어셈블 코드에서 특정 문자열을 찾을 수 있습니다.

Disassembler Code 창의 메뉴는 File 하나입니다. Save As로 주석이 붙은 역어셈블 코드를 파일에 저장하고, Close로 창을 닫습니다.

영어 원문

Obtaining performance data for your application

With Xprofiler, you can get performance data for your application on a number of levels, and in a number of ways.

You can easily view data pertaining to a single function, or you can use the reports provided to get information on your application as a whole.

Obtaining basic data

Xprofiler makes it easy to get data on specific items in the function call tree.

After you located the item that you are interested, you can get the data by using a number of ways. If you cannot locate a function in the function call tree, see Locate a function section.

Basic function data:

Review each function box in the function call tree is a label that contains basic performance data.

The label contains the name of the function, its associated cycle, if any, and its index. In the preceding figure, the name of the function is sub1. It is associated with cycle 1, and its index is 5. Also, depending on whether the function call tree is viewed in summary mode or average mode, the label will contain different information.

If the function call tree is viewed in summary mode, the label will contain the following information:

  • The total amount of CPU time (in seconds) this function spent on itself plus the amount of CPU time it spent on its descendants (the number on the left of the x).

  • The amount of CPU time (in seconds) this function spent only on itself (the number on the right of the x).

If the function call tree is viewed in average mode, the label will contain the following information:

  • The average CPU time (in seconds), among all the input gmon.out files, used on the function itself

  • The standard deviation of CPU time (in seconds), among all the input gmon.out files, used on the function itself

For more information about summary mode and average mode, see Controlling the representation of the function call tree.

Because labels are not always visible in the Xprofiler window when it is fully zoomed out, you might need to zoom in on it in order to see the labels. For information about how to do this, see Information boxes. Figure 30. An example of a function box label

Basic call data:

Call arc labels appear over each call arc. The label indicates the number of calls that were made between the two functions (from caller to callee).

For example:

To see a call arc label, you can zoom in on it. For information about how to do this, see “Information boxes.”

Basic cluster data:

Cluster box labels indicate the name of the library that is represented by that cluster. If it is a shared library, the label shows its full path name.

Information boxes:

For each function box, call arc, and cluster box, a corresponding information box gives you the same basic data that appears on the label.

This is useful when the Xprofiler display is fully zoomed out and the labels are not visible. To access the information box, click on the function box, call arc, or cluster box (place the mouse pointer over the edge of the box) with the left mouse button. The information box appears.

For a function, the information box contains the following:

  • The name of the function, its associated cycle, if any, and its index.

  • The amount of CPU used by this function. There are two values supplied in this field. The first is the amount of CPU time spent on this function plus the time spent on its descendants. The second value represents the amount of CPU time this function spent only on itself.

  • The number of times this function was called (by itself or any other function in the application).

For a call, the information box contains the following:

  • The caller and callee functions (their names) and their corresponding indexes

  • The number of times the caller function called the callee

For a cluster, the information box contains the following: Figure 31. An example of a call arc label

  • The name of the library

  • The total CPU usage (in seconds) consumed by the functions within it

Function menu statistics report option:

You can get performance statistics for a single function through the Statistics Report option of the Function menu. This option lets you see data on the CPU usage and call counts of the selected function.

If you are using more than one gmon.out file, the Statistics Report option breaks down the statistics for each gmon.out file you use.

When you select the Statistics Report menu option, the Function Level Statistics Report window appears.

The Function Level Statistics Report window provides the following information:

Function name:

The name of the function you selected.

Summary Data:

The total amount of CPU used by this function. If you used multiple gmon.out files, the value shown here represents their sum.

The CPU Usage field indicates:

  • The amount of CPU time used by this function. There are two values supplied in this field. The first is the amount of CPU time spent on this function plus the time spent on its descendants. The second value represents the amount of CPU time this function spent only on itself. Figure 32. The Function Level Statistics Report window

The Call Counts field indicates:

  • The number of times this function called itself, plus the number of times it was called by other functions.

Statistics data:

The CPU usage and calls made to or by this function, broken down for each gmon.out file.

The CPU Usage field indicates:

  • Average The average CPU time used by the data in each gmon.out file.

  • Std Dev Standard deviation. A value that represents the difference in CPU usage samplings, per function, from one gmon.out file to another. The smaller the standard deviation, the more balanced the workload.

  • Maximum Of all the gmon.out files, the maximum amount of CPU time used. The corresponding gmon.out file appears to the right.

  • Minimum Of all the gmon.out files, the minimum amount of CPU time used. The corresponding gmon.out file appears to the right.

The Call Counts field indicates:

  • Average The average number of calls made to this function or by this function, for each gmon.out file.

  • Std Dev Standard deviation. A value that represents the difference in call count sampling, per function, from one gmon.out file to another. A small standard deviation value in this field means that the function was almost always called the same number of times in each gmon.out file.

  • Maximum The maximum number of calls made to this function or by this function in a single gmon.out file. The corresponding gmon.out file appears to the right.

  • Minimum The minimum number of calls made to this function or by this function in a single gmon.out file. The corresponding gmon.out file appears to the right.

Getting detailed data from reports

Xprofiler provides performance data in textual and tabular format. This data is provided in various tables called reports.

Similar to the gprof command, Xprofiler generates the Flat Profile, Call Graph Profile, and Function Index reports, as well as two additional reports.

You can access the Xprofiler reports from the Report menu. The Report menu displays the following reports:

  • Flat Profile

  • Call Graph Profile

  • Function Index

  • Function Call Summary

  • Library Statistics

Each report window includes a File menu. Under the File menu is the Save As option, which lets you save the report to a file. For information about using the Save File Dialog window to save a report to a file, see Saving the call graph profile, function index, and flat profile reports to a file.

Note: If you select the Save As option from the Flat Profile, Function Index, or Function Call Summary report window, you must either complete the save operation or cancel it before you can select any other option from the menus of these reports. You can, however, use the other Xprofiler menus before completing the save operation or canceling it, with the exception of the Load Files option of the File menu, which remains unavailable.

Each of the Xprofiler reports are explained as follows.

Flat profile report:

When you select the Flat Profile menu option, the Flat Profile window appears.

The Flat Profile report shows you the total execution times and call counts for each function (including shared library calls) within your application. The entries for the functions that use the greatest percentage of the total CPU usage appear at the top of the list, while the remaining functions appear in descending order, based on the amount of time used.

Unless you specified the -z flag, the Flat Profile report does not include functions that have no CPU usage and no call counts. The data presented in the Flat Profile window is the same data that is generated with the gprof command.

The Flat Profile report looks similar to the following:

Figure 33. The Flat Profile report

Flat profile window fields:

This topic provides detailed information about the Flat Profile fields.

The Flat Profile window contains the following fields:

  • %time The percentage of the program's total CPU usage that is consumed by this function.

  • cumulative seconds A running sum of the number of seconds used by this function and those listed above it.

  • self seconds The number of seconds used by this function alone. Xprofiler uses the self seconds values to sort the functions of the Flat Profile report.

  • calls The number of times this function was called (if this function is profiled). Otherwise, it is blank.

  • self ms/call The average number of milliseconds spent in this function per call (if this function is profiled). Otherwise, it is blank.

  • total ms/call The average number of milliseconds spent in this function and its descendants per call (if this function is profiled). Otherwise, it is blank.

  • name The name of the function. The index appears in brackets ([]) to the right of the function name. The index serves as the function's identifier within Xprofiler. It also appears below the corresponding function in the function call tree.

Call graph profile report:

The Call Graph Profile menu option lets you view the functions of your application, sorted by the percentage of total CPU usage that each function, and its descendants, consumed. When you select this option, the Call Graph Profile window appears.

Unless you specified the -z flag, the Call Graph Profile report does not include functions whose CPU usage is 0 (zero) and have no call counts. The data presented in the Call Graph Profile window is the same data that is generated with the gprof command.

The Call Graph Profile report looks similar to the following:

Call graph profile window fields:

The following information provides detailed information about the Call Graph Profile fields.

The Call Graph Profile window contains the following fields:

  • index The index of the function in the Call Graph Profile. Each function in the Call Graph Profile has an associated index number which serves as the function's identifier. The same index also appears with each function box label in the function call tree, as well as other Xprofiler reports.

  • %time The percentage of the program's total CPU usage that was consumed by this function and its descendants.

  • self The number of seconds this function spends within itself.

  • descendants The number of seconds spent in the descendants of this function, on behalf of this function.

  • called/total, called+self, called/total The heading of this column refers to the different kinds of calls that take place within your program. The values in this field correspond to the functions listed in the name, index, parents, children field to its right. Depending on whether the function is a parent, a child, or the function of interest (the function with the index listed in the index field of this row), this value might represent the number of times that: – a parent called the function of interest – the function of interest called itself, recursively – the function of interest called a child Figure 34. The Call Graph Profile report

In the following figure, sub2 is the function of interest, sub1 and main are its parents, and printf and sub1 are its children.

  • called/total For a parent function, the number of calls made to the function of interest, as well as the total number of calls it made to all functions.

  • called+self The number of times the function of interest called itself, recursively.

  • name, index, parents, children The layout of the heading of this column indicates the information that is provided. To the left is the name of the function, and to its right is the function's index number. Appearing above the function are its parents, and below are its children.

  • name The name of the function, with an indication of its membership in a cycle, if any. The function of interest appears to the left, while its parent and child functions are indented above and below it.

  • index The index of the function in the Call Graph Profile. This number corresponds to the index that appears in the index column of the Call Graph Profile and the on the function box labels in the function call tree. Figure 35. The called/total, call/self, called/total field

Figure 36. The name/index/parents/children field

  • parents The parents of the function. A parent is any function that directly calls the function in which you are interested. If any portion of your application was not compiled with the -pg flag, Xprofiler cannot identify the parents for the functions within those portions. As a result, these parents will be listed as spontaneous in the Call Graph Profile report.

  • children The children of the function. A child is any function that is directly called by the function in which you are interested.

Function index report:

The Function Index menu option lets you view a list of the function names included in the function call tree.

When you select this option, the Function Index window appears and displays the function names in alphabetical order. To the left of each function name is its index, enclosed in brackets ([]). The index is the function's identifier, which is assigned by Xprofiler. An index also appears on the label of each corresponding function box in the function call tree, as well as on other reports.

Unless you specified the -z flag, the Function Index report does not include functions that have no CPU usage and no call counts.

Like the Flat Profile menu option, the Function Index menu option includes a Code Display menu, so you can view source code or disassembler code. See Looking at your code for more information.

The Function Index report looks similar to the following:

Function call summary report:

The Function Call Summary menu option lets you display all the functions in your application that call other functions. They appear as caller-callee pairs (call arcs, in the function call tree), and are sorted by the number of calls in descending order.

When you select this option, the Function Call Summary window appears.

The Function Call Summary report looks similar to the following: Figure 37. The Function Index report

Function call summary window fields:

This topic provides detailed information about the Function Call Summary fields.

The Function Call Summary window contains the following fields:

  • %total The percentage of the total number of calls generated by this caller-callee pair

  • calls The number of calls attributed to this caller-callee pair

  • function The name of the caller function and callee function

Library statistics report:

The Library Statistics menu option lets you display the CPU time consumed and call counts of each library within your application. When you select this option, the Library Statistics window appears.

The Library Statistics report looks similar to the following: Figure 38. The Function Call Summary report

Library statistics window fields:

This topic provides detailed information about the Library Statistics fields.

The Library Statistics window contains the following fields:

  • total seconds The total CPU usage of the library, in seconds

  • %total time The percentage of the total CPU usage that was consumed by this library

  • total calls The total number of calls that this library generated

  • %total calls The percentage of the total calls that this library generated

  • %calls out of The percentage of the total number of calls made from this library to other libraries

  • %calls into The percentage of the total number of calls made from other libraries into this library

  • %calls within The percentage of the total number of calls made between the functions within this library

  • load unit The library's full path name Figure 39. The Library Statistics report

Saving reports to a file:

Xprofiler lets you save any of the reports you generate with the Report menu to a file.

You can do this using the File and Report menus of the Xprofiler GUI.

Saving a single report:

To save a single report, go to the Report menu on the Xprofiler main window and select the report you want to save.

Each report window includes a File menu. Select the File menu and then the Save As option to save the report. A Save dialog window appears, which is named according to the report from which you selected the Save As option. For example, if you chose Save As from the Flat Profile window, the save window is named Save Flat Profile Dialog.

Saving the call graph profile, function index, and flat profile reports to a file:

You can save the Call Graph Profile, Function Index, and Flat Profile reports to a single file through the File menu of the Xprofiler main window.

The information you generate here is identical to the output of the gprof command. From the File menu, select the Save As option. The Save File Dialog window appears.

To save the reports, do the following:

  1. Specify the file into which the profiled data should be placed. You can specify either an existing file or a new one. To specify an existing file, use the scroll bars of the Directories and Files selection boxes to locate the file. To make locating your files easier, you can also use the Filter button (see Filtering what you see for more information). To specify a new file, type its name in the Selection field.

  2. Click OK. A file that contains the profiled data appears in the directory you specified, under the name you gave it.

Note: After you select the Save As option from the File menu and the Save Profile Reports window opens, you must either complete the save operation or cancel it before you can select any other option from the menus of its parent window. For example, if you select the Save As option from the Flat Profile report and the Save File Dialog window appears, you cannot use any other option of the Flat Profile report window.

The File Selection field of the Save File Dialog window follows Motif standards.

Saving summarized data from multiple profile data files:

If you are profiling a parallel program, you can specify more than one profile data (gmon.out) file when you start Xprofiler.

The Save gmon.sum As option of the File menu lets you save a summary of the data in each of these files to a single file.

The Xprofiler Save gmon.sum As option produces the same result as the xprofiler -s command and the gprof -s command. If you run Xprofiler later, you can use the file you create here as input with the -s flag. In this way, you can accumulate summary data over several runs of your application.

To create a summary file, do the following:

  1. Select the File menu, and then the Save gmon.sum As option. The Save gmon.sum Dialog window appears.

  2. Specify the file into which the summarized, profiled data should be placed. By default, Xprofiler puts the data into a file called gmon.sum. To specify a new file, type its name in the selection field. To specify an existing file, use the scroll bars of the Directories and Files selection boxes to locate the file you want. To make locating your files easier, you can also use the Filter button (see Filtering what you see for information).

  3. Click OK. A file that contains the summary data appears in the directory you specified, under the name you specified.

Saving a configuration file:

The Save Configuration menu option lets you save the names of the functions that are displayed currently to a file.

Later, in the same Xprofiler session or in a different session, you can read this configuration file in using the Load Configuration option. For more information, see “Loading a configuration file”.

To save a configuration file, do the following:

  1. Select the File menu, and then the select Save Configuration. The Save Configuration File Dialog window displays with the program.cgf file as the default value in the Selection field, where program is the name of the input in the a.out file. You can use the default file name, enter a file name in the Selection field, or select a file from the file list.

  2. Specify a file name in the Selection field and click OK. A configuration file is created that contains the name of the program and the names of the functions that are displayed currently.

  3. Specify an existing file name in the Selection field and click OK. An Overwrite File Dialog window appears so that you can check the file before overwriting it.

If you selected the Forced File Overwriting option in the Runtime Options Dialog window, the Overwrite File Dialog window does not open and the specified file is overwritten without warning.

Loading a configuration file:

The Load Configuration menu option lets you read in a configuration file that you saved.

See “Saving a configuration file” for more information. The Load Configuration option automatically reconstructs the function call tree according to the function names recorded in the configuration file.

To load a configuration file, do the following:

  1. Select the File menu, and then the Load Configuration option. The Load Configuration File Dialog window opens. If configuration files were loaded previously during the current Xprofiler session, the name of the file that was most recently loaded will appear in the Selection field of this dialog. You can also load the file with the -c flag. For more information, see Specifying command line options (from the GUI).

  2. Select a configuration file from the dialog's Files list or specify a file name in the Selection field and click OK. The function call tree is redrawn to show only those function boxes for functions that are listed in the configuration file and are called within the program that is currently represented in the display. All corresponding call arcs are also drawn. If the a.out name, that is, the program name in the configuration file, is different from the a.out name in the current display, a confirmation dialog asks you whether you still want to load the file.

  3. If after loading a configuration file, you want to return the function call tree to its previous state, select the Filter menu, and then the Undo option.

Looking at your code

Xprofiler provides several ways for you to view your code. You can view the source code or the disassembler code for your application, for each function. This also applies to any included function code that your application might use.

To view source or included function code, use the Source Code window. To view disassembler code, use the Disassembler Code window. You can access these windows through the Report menu of the Xprofiler GUI or the Function menu of the function you are interested in.

Viewing the source code:

Both the Function menu and Report menu permits you to access the Source Code window, from which you can view your code.

To access the Source Code window through the Function menu, complete the following steps:

  1. Click the function box you are interested in with the right mouse button. The Function menu appears.

  2. From the Function menu, select the Show Source Code option.

To access the Source Code window through the Report menu, complete the following steps:

  1. Select the Report menu, and then the Flat Profile option. The Flat Profile window appears.

  2. From the Flat Profile window, select the function you would like to view by clicking the entry in the window. The entry is highlighted to show that it is selected.

  3. Select the Code Display menu, and then the Show Source Code option.

Using the source code window:

The Source Code window shows you the source code file for the function you specified from the Flat Profile window or the Function menu.

The Source Code window looks similar to the following:

The Source Code window contains information in the following fields:

  • line The source code line number.

  • no. ticks per line Each tick represents .01 seconds of CPU time used. The value in this field represents the number of ticks used by the corresponding line of code. For example, if the number 3 appeared in this field, for a source statement, this source statement would have used .03 seconds of CPU time. The CPU usage data only appears in this field if you used the -g flag when you compiled your application. Otherwise, this field is blank.

  • source code The application's source code.

The Source Code window contains the following menus:

  • File The Save As option lets you save the annotated source code to a file. When you select this option, the Save File Dialog window appears. For more information about using the Save File Dialog window, see Saving the call graph profile, function index, and flat profile reports to a file. To close the Source Code window, select Close.

  • Utility This menu contains the Show Included Functions option.

For C++ users, the Show Included Functions option lets you view the source code of included function files that are included by the application's source code. Figure 40. The Source Code window

If a selected function does not have an included function file associated with it or does not have the function file information available because the -g flag was not used for compiling, the Utility menu will be unavailable. The availability of the Utility menu indicates whether there is any included function-file information associated with the selected function.

When you select the Show Included Functions option, the Included Functions Dialog window appears, which lists all of the included function files. Specify a file by either clicking on one of the entries in the list with the left mouse button, or by typing the file name in the Selection field. Then click OK or Apply. After you select a file from the Included Functions Dialog window, the Included Function File window appears, displaying the source code for the file that you specified.

Viewing the disassembler code:

Both the Function menu and Report menu permit you to access the Disassembler Code window, from which you can view your code.

To access the Disassembler Code window through the Function menu, complete the following steps:

  1. Click the function you are interested in with the right mouse button. The Function menu appears.

  2. From the Function menu, select the Show Disassembler Code option.

To access the Disassembler Code window through the Report menu, complete the following steps:

  1. Select the Report menu, and then the Flat Profile option. The Flat Profile window appears.

  2. From the Flat Profile window, select the function you want to view by clicking the entry in the window. The entry is highlighted to show that it is selected.

  3. Select the Code Display menu, and then the Show Disassembler Code option.

Using the disassembler code window:

The Disassembler Code window shows you only the disassembler code for the function you specified from the Flat Profile window.

The Disassembler Code window looks similar to the following:

The Disassembler Code window contains information in the following fields:

  • address The address of each instruction in the function you selected (from either the Flat Profile window or the function call tree).

  • no. ticks per instr. Each tick represents .01 seconds of CPU time used. The value in this field represents the number of ticks used by the corresponding instruction. For instance, if the number 3 appeared in this field, this instruction would have used .03 seconds of CPU time.

  • instruction The execution instruction.

  • assembler code The execution instruction's corresponding assembler code.

  • source code The line in your application's source code that corresponds to the execution instruction and assembler code. In order for information to appear in this field, you must have compiled your application with the -g flag.

The Search Engine field at the bottom of the Disassembler Code window lets you search for a specific string in your disassembler code.

The Disassembler Code window contains one menu:

  • File Figure 41. The Disassembler Code window

Select Save As to save the annotated disassembler code to a file. When you select this option, the Save File Dialog window appears. For information on using the Save File Dialog window, see Saving the call graph profile, function index, and flat profile reports to a file. To close the Disassembler Code window, select Close.

프로파일링 데이터 화면 이미지 저장하기

Xprofiler GUI의 File 메뉴에는 Xprofiler 주 창의 이미지를 잡는 Screen Dump 항목이 있습니다. 그래픽 화면의 사본을 나중에 보려고 저장할 때 유용합니다. 이미지를 PostScript 파일로 저장하거나 바로 프린터로 보낼 수 있습니다.

창 이미지를 잡으려면 다음과 같이 합니다.

  1. File, Screen Dump를 고릅니다. Screen Dump 메뉴가 열립니다.
  2. Screen Dump 메뉴에서 Set Option을 고릅니다. Screen Dump Options Dialog 창이 나옵니다.
  3. 창의 필드를 다음과 같이 고릅니다.
필드 설명
Output To 잡은 이미지를 PostScript 파일로 저장할지 프린터로 바로 보낼지 정합니다. 파일로 저장하려면 File 단추를 고릅니다. 파일 이름은 기본 Xprofiler.screenDump.ps.0이며 Default File Name 필드에 나오고, File을 고르면 Print Command 필드가 흐려집니다. 프린터로 바로 보내려면 Printer 단추를 고르며, Print Command 필드의 프린터로 보냅니다. 이때는 이미지 파일을 저장하지 않고 Default File Name 필드가 비활성이 됩니다.
PostScript Output 이미지를 회색조로 잡을지 컬러로 잡을지 정합니다. 회색조는 GreyShades 단추를 고르고 Number of Grey Shades로 단계 수를 정합니다. 컬러는 Color 단추를 고릅니다.
Number of Grey Shades 잡은 이미지의 회색 단계 수. 2, 4, 16 가운데 고릅니다. 단계가 많을수록 보통 인쇄가 오래 걸립니다.
Delay Before Grab 잡기를 시작한 뒤 실제로 이미지를 잡을 때까지의 지연. 기본 1초이며, 창을 원하는 대로 배치할 시간이 필요하면 슬라이더로 늘립니다. 최대 30초입니다.
Enable Landscape (단추) 출력을 가로(landscape) 형식으로 합니다(기본은 세로).
Annotate Output (단추) 파일을 어떻게 만들었는지에 관한 정보를 PostScript 이미지 파일에 넣습니다(기본은 넣지 않음).
Default File Name (필드) 파일로 저장할 때의 파일 이름. 기본 Xprofiler.screenDump.ps.0입니다. 이름 끝이 xxx.nn(nn은 음이 아닌 정수)이면 같은 세션에서 새 출력 파일을 쓸 때마다 접미사가 1씩 늘어납니다.
Print Command (필드) 프린터로 바로 보낼 때의 인쇄 명령. 기본 qprt -B ga -c -Pps입니다.
  1. OK를 누릅니다. Screen Dump Options Dialog 창이 닫힙니다.

옵션을 정한 뒤 잡을 창이나 창의 일부를 고릅니다. Screen Dump 메뉴에서 Select Target Window를 고르면 지정한 초가 지난 뒤 손 모양 커서가 나옵니다. 잡기를 취소하려면 오른쪽 단추를 누릅니다. 커서가 원래대로 돌아오고 작업이 끝납니다.

Xprofiler 창 전체를 잡으려면 커서를 창에 두고 왼쪽 단추를 누릅니다.

창의 일부를 잡으려면 다음과 같이 합니다.

  1. 잡을 영역의 왼쪽 위 모서리에 커서를 둡니다.
  2. 가운데 단추를 누른 채 대각선 아래로 끌어 잡을 영역이 고무줄 상자 안에 들어오게 합니다.
  3. 가운데 단추를 놓아 고무줄 상자의 위치를 정합니다.
  4. 왼쪽 단추를 눌러 이미지를 잡습니다.

파일로 저장하도록 했으면 지정한 디렉터리에 파일이 저장되고, 인쇄하도록 했으면 지정한 프린터로 이미지가 보내집니다.

영어 원문

Saving screen images of profiled data

The File menu of the Xprofiler GUI includes an option called Screen Dump that lets you capture an image of the Xprofiler main window.

This option is useful if you want to save a copy of the graphical display to refer to later. You can either save the image as a file in PostScript format, or send it directly to a printer.

To capture a window image, do the following:

  1. Select File and then Screen Dump. The Screen Dump menu opens.

  2. From the Screen Dump menu, select Set Option. The Screen Dump Options Dialog window appears.

  3. Make the appropriate selections in the fields of the Screen Dump Options Dialog window, as follows:

  • Output To:

Figure 42. The Screen Dump Options Dialog window

This option lets you specify whether you want to save the captured image as a PostScript file or send it directly to a printer. If you would like to save the image to a file, select the File button. This file, by default, is named Xprofiler.screenDump.ps.0, and is displayed in the Default File Name field of this dialog window. When you select the File button, the text in the Print Command field greys out. To send the image directly to a printer, select the Printer button. The image is sent to the printer you specify in the Print Command field of this dialog window. When you specify the Print option, a file of the image is not saved. Also, selecting this option causes the text in the Default File Name field is made unavailable.

  • PostScript Output: This option lets you specify whether you want to capture the image in shades of grey or in color. If you want to capture the image in shades of grey, select the GreyShades button. You must also select the number of shades you want the image to include with the Number of Grey Shades option, as discussed below. If you want to capture the image in color, select the Color button.

  • Number of Grey Shades This option lets you specify the number of grey shades that the captured image will include. Select either the 2, 4, or 16 buttons, depending on the number of shades you want to use. Typically, the more shades you use, the longer it will take to print the image.

  • Delay Before Grab This option lets you specify how much of a delay will occur between activating the capturing mechanism and when the image is actually captured. By default, the delay is set to one second, but you might need time to arrange the window the way you want it. Setting the delay to a longer interval gives you some extra time to do this. You set the delay with the slider bar of this field. The number above the slider indicates the time interval in seconds. You can set the delay to a maximum of thirty seconds.

  • Enable Landscape (button) This option lets you specify that you want the output to be in landscape format (the default is portrait). To select landscape format, select the Enable Landscape button.

  • Annotate Output (button) This option lets you specify that you would like information about how the file was created to be included in the PostScript image file. By default, this information is not included. To include this information, select the Annotate Output button.

  • Default File Name (field) If you chose to put your output in a file, this field lets you specify the file name. The default file name is Xprofiler.screenDump.ps.0. If you want to change to a different file name, type it over the one that appears in this field. If you specify the output file name with an integer suffix (that is, the file name ends with xxx.nn, where nn is a non-negative integer), the suffix automatically increases by one every time a new output file is written in the same Xprofiler session.

  • Print Command (field) If you chose to send the captured image directly to a printer, this field lets you specify the print command. The default print command is qprt -B ga -c -Pps. If you want to use a different command, type the new command over the one that appears in this field.

  1. Click OK. The Screen Dump Options Dialog window closes.

After you have set your screen dump options, you need to select the window, or portion of a window, you want to capture. From the Screen Dump menu, select the Select Target Window option. A cursor that looks like a person's hand appears after the number of seconds you specified. To cancel the capture, click the right mouse button. The hand-shaped cursor will revert to normal and the operation will be terminated.

To capture the entire Xprofiler window, place the cursor in the window and then click the left mouse button.

To capture a portion of the Xprofiler window, do the following:

  1. Place the cursor in the upper left corner of the area you want to capture.

  2. Press and hold the middle mouse button and drag the cursor diagonally downward, until the area you want to capture is within the rubberband box.

  3. Release the middle mouse button to set the location of the rubberband box.

  4. Press the left mouse button to capture the image.

If you chose to save the image as a file, the file is stored in the directory that you specified. If you chose to print the image, the image is sent to the printer you specified.

Xprofiler 자원 설정

X Window System의 일부 기능, 예를 들어 색, 글꼴, 방향을 원하는 대로 바꿀 수 있습니다. 이 절은 Xprofiler에 설정할 수 있는 자원 변수를 나열합니다.

자원은 표준 X Window System 형식으로 자원 이름에 값을 주어 설정합니다. X Window System 규칙에 따라 다음 자원 파일을 차례로 찾습니다.

text
/usr/lib/X11/$LANG/app-defaults/Xprofiler
/usr/lib/X11/app-defaults/Xprofiler
$XAPPLRESDIR/Xprofiler
$HOME/.Xdefaults

.Xdefaults 파일의 옵션이 위 파일들의 항목보다 우선합니다. 그래서 app-defaults 파일에는 모든 사용자에게 적용할 설정을, 각 사용자의 $HOME/.Xdefaults 파일에는 사용자별 취향을 둘 수 있습니다.

자원은 해당 기능의 자원 변수에 값을 주어 설정하며, 홈 디렉터리의 .Xdefaults 파일에 저장합니다. 서버에 이 파일을 만들어 모든 사용자의 자원을 설정할 수도 있고, 사용자마다 따로 설정할 수도 있습니다. 자원 설정은 본질적으로 X Window System이 어떻게 보일지에 대한 개인 취향입니다.

예를 들어 가상의 X Window System 도구에 다음 자원 변수가 있다고 합시다.

text
TOOL*MainWindow.foreground:
TOOL*MainWindow.background:

TOOL*MainWindow.foreground가 도구 주 창의 글자 색을, TOOL*MainWindow.background가 같은 창의 배경색을 정한다고 하면, 주 창을 흰 바탕에 빨간 글자로 하려면 .Xdefaults 파일에 다음 줄을 넣습니다.

text
TOOL*MainWindow.foreground:    red
TOOL*MainWindow.background:    white

Xprofiler에서 설정할 수 있는 자원과 사용법은 /usr/lib/X11/app-defaults/Xprofiler 파일과 /usr/lpp/ppe.xprofiler/defaults/Xprofiler.ad 파일에 정의되어 있습니다. 이 파일에는 다음 기준으로 GUI를 정의하는 X Window System 자원이 들어 있습니다.

  • 창 크기와 위치(geometry)
  • 창 제목
  • 누름 단추와 이름표 글자
  • 색상 맵
  • 글꼴(텍스트 보고서와 그래픽 화면 모두)

Xprofiler 자원 변수

다음 자원 변수로 Xprofiler의 모양과 동작을 제어할 수 있습니다. 표의 값은 기본값이며 원하는 값으로 바꿀 수 있습니다.

글꼴 제어:

자원 변수 기본값
*narc*font fixed (함수 상자·호출 호·클러스터 상자 이름표의 글꼴)
Xprofiler*fontList rom10 (텍스트 보고서의 글꼴)

주 창의 모양 제어(크기, 전경·배경색, 함수 상자 수):

자원 변수 기본값
Xprofiler*mainW.height 700 (주 창 높이)
Xprofiler*mainW.width 900 (주 창 너비)
Xprofiler*foreground black (주 창 전경색)
Xprofiler*background light grey (주 창 배경색)
Xprofiler*InitialDisplayGraph 5000 (주 창을 처음 열 때 보일 함수 상자 수. -disp_max 플래그가 우선)
Xprofiler*defaultNodeColor forest green (함수 상자 색)
Xprofiler*defaultArcColor royal blue (호출 호 색)
Xprofiler*HighlightNode red (강조한 함수 상자 색)
Xprofiler*HighlightArc red (강조한 호출 호 색)
Xprofiler*SuppressNode grey (흐리게 표시한 함수 상자 색. -e, -E, -f, -F 플래그로 흐려짐)

File 메뉴 관련 변수(Load Files Dialog 창 크기, 다른 검색 경로, 검색 순서):

자원 변수 기본값
Xprofiler*loadFile.height 785 (Load Files Dialog 창 높이. File 메뉴의 Load Files로 엶)
Xprofiler*loadFile.width 725 (Load Files Dialog 창 너비)
Xprofiler*OverwriteOK False (파일을 덮어쓸 때 확인 대화상자를 띄울지. True는 File 메뉴 Set Options의 Runtime Options Dialog 창에서 Forced File Overwriting을 고른 것과 같음)
Xprofiler*fileSearchPath . (현재 작업 디렉터리. 소스·라이브러리 파일의 다른 검색 경로이며 Alt File Search Path Dialog 창에서 지정하는 것과 같음)
Xprofiler*fileSearchDefault True (기본 경로를 먼저 찾을지. True는 Alt File Search Path Dialog 창의 Check default path(s) first와 같음)

화면 덤프 관련 변수(저장 위치, 색, 잡기 전 대기 시간). 모두 File 메뉴의 Screen Dump, Set Option으로 여는 Screen Dump Options Dialog 창의 항목에 해당합니다.

자원 변수 기본값
Xprofiler*PrintToFile True (화면 덤프를 파일로 저장. Output To 필드의 File 단추와 같음)
Xprofiler*ColorPscript False (PostScript를 컬러로. False는 PostScript Output의 GreyShades와 같음)
Xprofiler*GreyShades 16 (회색 단계 수. GreyShades를 골랐을 때)
Xprofiler*GrabDelay 1 (이미지를 잡기 전 대기 초. Delay Before Grab의 기본값)
Xprofiler*grabDelayScale.maximum 30 (Delay Before Grab 슬라이더의 최댓값)
Xprofiler*Landscape False (가로 형식으로 만들지. Enable Landscape 단추)
Xprofiler*Annotate False (만든 방법 정보를 PostScript에 넣을지. Annotate Output 단추)
Xprofiler*PrintFileName /tmp/Xprofiler_screenDump.ps.0 (Output To가 File일 때의 저장 파일)
Xprofiler*PrintCommand qprt -B ga -c -Pps (Output To가 Printer일 때의 인쇄 명령)

View 메뉴 관련 변수(Overview 창 크기와 강조 영역):

자원 변수 기본값
Xprofiler*overviewMain.height 300 (Overview 창 높이)
Xprofiler*overviewMain.width 300 (Overview 창 너비)
Xprofiler*overviewGraph*defaultHighlightColor sky blue (Overview 창 강조 영역 색)
Xprofiler*TrackImmed True (강조 영역을 움직이는 동안 바로 갱신. Overview 창 Utility 메뉴의 Immediate Update와 같음)
Xprofiler*Shape2D True (함수 상자를 2차원으로. View 메뉴의 2-D Image와 같음)
Xprofiler*LayoutTopDown True (트리를 위에서 아래로. View 메뉴의 Layout: Top and Bottom과 같음)

Filter 메뉴 관련 변수(처음 열 때 함수 상자 묶기, 호출 호 접기):

자원 변수 기본값
Xprofiler*ClusterNode True (주 창을 처음 열 때 함수 상자를 라이브러리별로 묶음. Filter 메뉴의 Cluster Functions by Library와 같음)
Xprofiler*ClusterArc True (주 창을 처음 열 때 호출 호를 접음. Filter 메뉴의 Collapse Library Arcs와 같음)
영어 원문

Customizing Xprofiler resources

You can customize certain features of an X Window System. For example, you can customize its colors, fonts, and orientation. This section lists each of the resource variables you can set for Xprofiler.

You can customize resources by assigning a value to a resource name in a standard X Window System format. Several resource files are searched according to the following X Window System convention:

text
/usr/lib/X11/$LANG/app-defaults/Xprofiler
/usr/lib/X11/app-defaults/Xprofiler
$XAPPLRESDIR/Xprofiler
$HOME/.Xdefaults

Options in the .Xdefaults file take precedence over entries in the preceding files. This permits you to have certain specifications apply to all users in the app-defaults file, as well as user-specific preferences set for each user in their $HOME/.Xdefaults file.

You customize a resource by setting a value to a resource variable associated with that feature. You store these resource settings in a file called .Xdefaults in your home directory. You can create this file on a server, and so customize a resource for all users. Individual users might also want to customize resources. The resource settings are essentially your personal preferences for how the X Window System should look.

For example, consider the following resource variables for a hypothetical X Window System tool:

text
TOOL*MainWindow.foreground:
TOOL*MainWindow.background:

In this example, suppose the resource variable TOOL*MainWindow.foreground controls the color of text on the tool's main window. The resource variable TOOL*MainWindow.background controls the background color of this same window. If you wanted the tool's main window to have red lettering on a white background, you would insert these lines into the .Xdefaults file:

text
TOOL*MainWindow.foreground:    red
TOOL*MainWindow.background:    white

Customizable resources and instructions for their use for Xprofiler are defined in /usr/lib/X11/app-defaults/Xprofiler file, as well as /usr/lpp/ppe.xprofiler/defaults/Xprofiler.ad file. This file contains a set of X Window System resources for defining graphical user interfaces based on the following criteria:

  • Window geometry

  • Window title

  • Push button and label text

  • Color maps

  • Text font (in both textual reports and the graphical display)

Xprofiler resource variables

You can use the following resource variables to control the appearance and behavior of Xprofiler. The values listed in this section are the defaults; you can change these values to suit your preferences.

Controlling fonts:

Review the following information to lean how to control Xprofiler fonts.

To specify the font for the labels that appear with function boxes, call arcs, and cluster boxes:

Use this resource variable: Specify this default, or a value of your choice: *narc*font fixed

To specify the font used in textual reports:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*fontList rom10

Controlling the appearance of the Xprofiler main window:

You can control the size, foreground, background, and number of function boxes, for the Xprofiler main window.

To specify the size of the main window:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*mainW.height 700 Xprofiler*mainW.width 900

To specify the foreground and background colors of the main window:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*foreground black Xprofiler*background light grey

To specify the number of function boxes that are displayed when you first open the Xprofiler main window:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*InitialDisplayGraph 5000

You can use the -disp_max flag to override this value.

To specify the colors of the function boxes and call arcs of the function call tree:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*defaultNodeColor forest green Xprofiler*defaultArcColor royal blue

To specify the color in which a specified function box or call arc is highlighted:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*HighlightNode red Xprofiler*HighlightArc red

To specify the color in which de-emphasized function boxes appear:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*SuppressNode grey

Function boxes are de-emphasized with the -e, -E, -f, and -F flags.

Controlling variables related to the file menu:

You can control the size of the Load Files Dialog window, alternative search paths for locating source or library files, and the file search sequence for the Xprofiler File menu.

To specify the size of the Load Files Dialog window, use the following:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*loadFile.height 785 Xprofiler*loadFile.width 725

The Load Files Dialog window is called by the Load Files option of the File menu.

To specify whether a confirmation dialog box should appear whenever a file will be overwritten:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*OverwriteOK False

The value True would be equivalent to selecting the Set Options option from the File menu, and then selecting the Forced File Overwriting option from the Runtime Options Dialog window.

To specify the alternative search paths for locating source or library files:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*fileSearchPath . (refers to the current working directory)

The value you specify for the search path is equivalent to the search path you would designate from the Alt File Search Path Dialog window. To get to this window, choose the Set File Search Paths option from the File menu.

To specify the file search sequence (whether the default or alternative path is searched first):

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*fileSearchDefault True

The value True is equivalent to selecting the Set File Search Paths from the File menu, and then the Check default path(s) first option from the Alt File Search Path Dialog window.

Controlling variables related to the screen dump option:

You can control the where you want the screen dump placed, the color of the screen dump, and how long to wait before capturing the screen dump for the Xprofiler Screen Dump window.

To specify whether a screen dump will be sent to a printer or placed in a file:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*PrintToFile True

The value True is equivalent to selecting the File button in the Output To field of the Screen Dump Options Dialog window. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To specify whether the PostScript screen dump will created in color or in shades of grey:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*ColorPscript False

The value False is equivalent to selecting the GreyShades button in the PostScript Output area of the Screen Dump Options Dialog window. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To specify the number of grey shades that the PostScript screen dump will include (if you selected

GreyShades in the PostScript Output area)

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*GreyShades 16

The value 16 is equivalent to selecting the 16 button in the Number of Grey Shades field of the Screen Dump Options Dialog window. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To specify the number of seconds that Xprofiler waits before capturing a screen image:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*GrabDelay 1

The value 1 is the default for the Delay Before Grab option of the Screen Dump Options Dialog window, but you can specify a longer interval by entering a value here. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To set the maximum number of seconds that can be specified with the slider of the Delay Before Grab option:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*grabDelayScale.maximum 30

The value 30 is the maximum for the Delay Before Grab option of the Screen Dump Options Dialog window. This means that users cannot set the slider scale to a value greater than 30. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To specify whether the screen dump is created in landscape or portrait format:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*Landscape False

The value True is the default for the Enable Landscape option of the Screen Dump Options Dialog window. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To specify whether you would like information about how the image was created to be added to the PostScript screen dump:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*Annotate False

The value False is the default for the Annotate Output option of the Screen Dump Options Dialog window. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To specify the directory that will store the screen dump file (if you selected File in the Output To field):

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*PrintFileName /tmp/Xprofiler_screenDump.ps.0

The value you specify is equivalent to the file name you would designate in the File Name field of the Screen Dump Dialog window. You access the Screen Dump Options Dialog window by selecting Screen Dump and then Set Option from the File menu.

To specify the printer destination of the screen dump (if you selected Printer in the Output To field):

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*PrintCommand qprt -B ga -c -Pps

The value qprt -B ga -c -Pps is the default print command, but you can supply a different one.

Controlling variables related to the view menu:

You can control the size of the window and the highlighted area for the window for the Xprofiler View menu.

To specify the size of the Overview window:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*overviewMain.height 300 Xprofiler*overviewMain.width 300

To specify the color of the highlight area of the Overview window:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*overviewGraph*defaultHighlightColor sky blue

To specify whether the function call tree is updated as the highlight area is moved (immediate) or only when it is stopped and the mouse button released (delayed):

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*TrackImmed True

The value True is equivalent to selecting the Immediate Update option from the Utility menu of the Overview window. You access the Overview window by selecting the Overview option from the View menu.

To specify whether the function boxes in the function call tree appear in two-dimensional or three-dimensional format:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*Shape2D True

The value True is equivalent to selecting the 2-D Image option from the View menu.

To specify whether the function call tree appears in top-to-bottom or left-to-right format:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*LayoutTopDown True

The value True is equivalent to selecting the Layout: Top and Bottom option from the View menu.

Controlling variables related to the filter menu:

You can control whether the function boxes of the function call tree are clustered or unclustered and whether the call arcs of the function call tree are collapsed or expanded for the Xprofiler Filter menu.

To specify whether the function boxes of the function call tree are clustered or unclustered when the Xprofiler main window is first opened:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*ClusterNode True

The value True is equivalent to selecting the Cluster Functions by Library option from the Filter menu.

To specify whether the call arcs of the function call tree are collapsed or expanded when the Xprofiler main window is first opened:

Use this resource variable: Specify this default, or a value of your choice: Xprofiler*ClusterArc True

The value True is equivalent to selecting the Collapse Library Arcs option from the Filter menu.

자주 쓰는 형태

bash
# ~/.Xdefaults 예: 창을 키우고 처음에 묶음을 풀어 보기
Xprofiler*mainW.height: 1000
Xprofiler*mainW.width: 1400
Xprofiler*ClusterNode: False
Xprofiler*InitialDisplayGraph: 100
bash
xrdb -merge ~/.Xdefaults
xprofiler -s ./myprog gmon.out.*     # 병렬 실행 결과를 합쳐 gmon.sum도 만듦