A handle to initialize and control the profiler. The output from the profiler provides processing time and call-tree information to locate bottlenecks. Developers can quickly identify where an application is spending the most processing time and navigate through the call tree to the potential bottlenecks.

Syntax

PROFILER [ :attribute | :method ]
attribute
Specifies an attribute of the PROFILER handle.
method
Specifies a method of the PROFILER handle.

Attributes

COVERAGE attribute DESCRIPTION attribute DIRECTORY attribute
ENABLED attribute FILE-NAME attribute HANDLE attribute
INSTANTIATING-PROCEDURE attribute LISTINGS attribute PROFILING attribute
STATISTICS attribute TRACE-FILTER attribute TRACING attribute
TYPE attribute

Methods

USER-DATA ( ) method WRITE-DATA( ) method

Notes

The best practice for profiling applications during development is to use the Run > Run Configurations in Progress Developer Studio to enable and set the profiler properties on the Profiler tab. This automatically sets the profiler attributes and writes the output to a file which automatically opens in the Profiler view. For more information, see Profiler View .

Developers who want to instrument the profiler using the PROFILER system handle must set mandatory attributes, optional attributes, enable profiling, and write the profiler data to the designated output file. The order that attributes are set matters.

  1. Set the ENABLED attribute.
    Note: Enabling and disabling profiling triggers the following actions on the profiler data output file, as listed below:
    • If you set PROFILER:ENABLED = FALSE, then profiling is disabled and the AVM writes the accumulated profiling data to the output file, and discards the registry of entries containing the list of active procedures and their module identifiers.
    • Profiling is automatically disabled if the ABL session exits while PROFILER:ENABLED = TRUE or if the AVM shuts down. This ensures that the profiling information is written to the output file.
  2. Set the FILE-NAME attribute.
    Note: If you do not want the profiler information in the file to be overwritten by a subsequent call to WRITE-DATA() then ensure that you provide a new FILE-NAME for the next profiling session and subsequent invocation of WRITE-DATA(). WRITE-DATA() can be called explicitly or by setting PROFILER:ENABLED = FALSE.
  3. Set the DESCRIPTION attribute
  4. Set the optional attributes: COVERAGE attribute, DIRECTORY attribute, LISTINGS attribute, STATISTICS attribute, TRACE-FILTER attribute and TRACING attribute.
    CAUTION: Avoid setting the STATISTICS attribute, as it produces large amounts of data. Enable it only if instructed by Technical Support.
  5. Turn on profiling with the PROFILING attribute.
  6. Run the application you want to profile.
  7. You can write the profiling information to an output file in one of two ways:
    • Disable profiling by setting PROFILER:ENABLED = FALSE to automatically write the profiler data to the output file.
    • Use the WRITE-DATA( ) method. WRITE-DATA() is useful if you want to save intermediate results without stopping profiling.
    Note: If you wish to capture subsequent profiler data, then ensure that you change the file name using PROFILER:FILE-NAME attribute. If you don't provide a new file name, then the previous file with the profiler data is overwritten.
  8. Turn off profiling when no longer needed with the PROFILING attribute.

The output file can be opened in the Profiler view in Progress Developer Studio.

Examples

The following example shows how to use the PROFILER programmatically. Note that the output is written automatically when PROFILER:ENABLED = FALSE.

/* Enable profiling */
PROFILER:ENABLED = TRUE.

/* Set output file for profiler data */
PROFILER:FILE-NAME = "myProfileData1.prof".

/* Start profiling */
PROFILER:PROFILING = TRUE.

/* Your application logic here */
RUN myProcedure.p.

/* Disable profiling and write output */
PROFILER:ENABLED = FALSE.

/* Turn off profiling */
PROFILER:PROFILING = FALSE.

In the following example, the WRITE-DATA() method is used to write intermediate output.

/* Enable profiling */
PROFILER:ENABLED = TRUE.

/* Set output file for profiler data */
PROFILER:FILE-NAME = "myProfileData2.prof".

/* Start profiling */
PROFILER:PROFILING = TRUE.

/* Your application logic here */
RUN myProcedure.p.

/* Stop profiling */
PROFILER:PROFILING = FALSE.

/* Write profiler data to file */
IF PROFILER:WRITE-DATA() THEN
    MESSAGE "Profiler data written successfully."
    VIEW-AS ALERT-BOX.
ELSE
    MESSAGE "Failed to write profiler data."
    VIEW-AS ALERT-BOX.
...

See also

Profiler View , Profiler (-profile) , Server-side profiling