Super Prev Next

Analyzing your program profile

Your XDS package contains a set of utilities that may help you to better understand and improve the run-time performance of your program. It emphasises the pieces of code which consume most of the CPU time, and, hence, are the first candidates for redesign.


Super Prev Next

Overview

The process of profiling takes two steps - execution tracing and visualisation. During execution tracing, your program is executed in debugging mode under control of the tracing utility. That utility interrupts the program at regular time intervals and records instruction pointer (EIP) values (snapshots), storing them in a trace file. A visualization utility reads that file and displays distribution of snapshots among your program components, modules, procedures, and source lines, using debug information from the program executable.


Super Prev Next

Execution tracing

Execution tracing is performed by the XPROF utility. To invoke it, issue the following command:

    XPROF { ("/" | "-") option } program [ arguments ]

where program is a name of a profiled executable and arguments are its optional command line arguments (not XPROF arguments).

Upon termination, XPROF creates a trace file in the current directory. Its name is built by appending the extension .XPT to the executable name.

Available options are:

/R=nnn Set snapshot interval to nnn ms Default is 55, minimum 32.
/A Append trace data to the existent .XPT file.

The /A option allows you to collect more snapshots, improving profile accuracy.


Super Prev Next

Visualisation

The visualisation utilities, XPDUMP and XPVIEW, read the collected trace data and collate it with the debug information bound to the executable. The results of that analysys are then displayed.


Super Prev Next

XPDUMP

XPDUMP is a command line utility. Given a name of a trace file, it prints to the standard output a mutlilevel list of components, modules, procedures, and source lines of the traced program.

XPDUMP command line syntax:

XPDUMP { ( "-" | "/" ) option } tracefile

XPDUMP options:

Option Description
/O=order Sort order: by (N)ame or (P)ercent
/L=level Sensitivity level in percents
/P=precision Precision (number of decimal positions)
/R Sort in reverse order
/G Display graph bar
/C Display components only
/M Display modules only
/S Display source
/F Show full path for modules

The default is /O=P /L=5 /P=1.

Here is a sample XPDUMP output:

-----------------------------------------------------------------------------
Snapshots: 200
-----------------------------------------------------------------------------
 90.4    90 ####################################.... SAMPLES\BENCH\dry.mod
 37.7    34 ###############.........................     Proc0
   20    18 ########................................     Proc1
 13.3    12 #####...................................     Proc8
  8.3   7.5 ###.....................................     Func2
  7.7     7 ###.....................................     Proc7

"Snapshots" is a total number of EIP values recorded in the trace file.

Have to write something here.about components !!!

For each module, the first column contains ratio between the number of snapshots belonging to the module and the number of snapshots belonging to all program modules. The second column contains ratio between the number of snapshots belonging to the module and the total number of snapshots.

For each procedure, the first column contains ratio between the number of snapshots belonging to the procedure and the number of snapshots belonging to the module which contains that procedure. The second column contains ratio between the number of snapshots belonging to the procedure and the total number of snapshots.

For each source line, the first column contains ratio between the number of snapshots belonging to the line and the number of snapshots belonging to the module which contains that line. The second column contains ratio between the number of snapshots belonging to the line and the total number of snapshots.


Super Prev Next

Profile viewer

XDS Profile Viewer is a GUI program which allows you to interactively browse your program profile. It can be invoked with the following command:

    XPVIEW [ tracefile ]

where tracefile is the name of the trace file which you want to display. If you did not specify it on the command line, press F3 or select Open from the File menu to load an .XPT file using a standard file dialog once XPVIEW is up and running.

XPVIEW displays profile information in four windows. The first window contains a list or your program components (EXE and DLLs). The second window contains the list of the source modules which constitute the currently selected component, the third — the list of procedures belonging to the currently selected module, and the fourth — the source code of the currently selected procedure.

Snapshots percentage in numeric and graphic formats is displayed to the left of each component, module, procedure, or source line.