Programming Tools:prgtools

Using the Xbase++ Profiler Foundation

The following steps are required to prepare an executable for the profiler and to analyze profiling data:

1. Prepare the EXE

To insert profile hooks into your application, all PRG source files you wish to analyze must be compiled using the /profile option of the Xbase++ compiler. This also instructs ALINK to link the XppProf.lib automatically. If you are using PBUILD, simply add the /profile switch to COMPILE_FLAGS=.

2. Start the profiler

Start the Xbase++ Profiler by entering on the command line:

XppProf <YourProg.exe> 

The profiler's front end will be started and you are requested to configure the trace.

3. Configure profiling data

The most critical part of a trace run is the amount of generated data. By identifying the data required for analysis, you can reduce the amount of data, thus saving space on your hard disk, and - more important - you need less time for analyzing the data.

The following table lists the most important options of the profiler. Refer to Profiler options for details.

Configurable options
Option Description
Built-in functions All functions not compiled with /profile can be excluded from the trace. This applies to internal or 3rd party function calls.
Parameter list The lists of passed parameters can be excluded.
Timeline Omitting time information reduces output data by 8 byte per call.
Line numbers Suppressing line numbers reduces output data by 8 byte per call.
Thread-Id The ID of an Xbase++ thread to be entirely excluded from the trace.
Symbols Names of functions or methods to be excluded from the trace.
Size for symbols Limiting function/method names to a fixed number of characters may reduce the amount of generated data considerably.
Human readable output The default output format is FOXDBE compliant. If this option is choosen, a DELDBE compatible output will be created that can be viewed with a text editor.

Sometimes, however, it is desired to include all available information into the trace because one must trace a hardly reproducible scenario or for other reasons. In this case, you can limit the output by excluding whole parts of the code. To accomplish this, insert the following into your code:

#include "profiler.ch" 

Imagine you are interested in tracing a particular part of your program only and this cannot be achieved with configurable options. For this purpose, the profiler provides the two functions:

prfHold( <cInfo> )   => NIL 

prfResume( <cInfo> ) => NIL 

Both functions accept as parameter a character string that is included in the trace for informational purposes.

Insert a prfHold() as early as possible, and call prfResume() before the code of interest is executed. Make sure to always pair the hold/resumes, otherwise the produced output of the program is unbalanced in terms of call levels and may become useless for later analysis.

#include "profiler.ch" 

PROCEDURE Main 
   
   prfHold( "FYI: Profiling stops" ) 
   DoSomething() 

   prfResume( "FYI: Profiling starts" ) 
   MyCalculationTakesTooLong() 

RETURN 

4. Start the trace run

Click the Start button in the profiler. This will start your program and profiling data is recorded until the program terminates.

5. Analyze the data

Start the Xbase++ Profiler Analyzing Tool by entering on the command line:

XppPat <YourProg.prf> 

See How to analyze Profiling datato learn what data is available.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.