PreviousDescriptions of Run-time Switches Terminfo Database and Terminal DevicesNext"

Chapter 14: The COBOL Profiler

The COBOL Profiler is a facility that enables you to obtain detailed statistics on the run-time performance of a COBOL program.

When you submit a COBOL source program to the cob command (see the chapter COBOL System Interface (cob) for details on the cob command), you can specify the PROFILE Compiler directive . This causes the Compiler to include code in your program to produce performance statistics about each paragraph of the program each time you run the compiled program. If your program contains no paragraphs, this report is not produced.

The performance statistics produced using the PROFILE Compiler directive for that run of the program are contained in a file called:

program-name.ipf

where program-name is the name of the program that was run. If an executable file is produced, then program-name is the first entry point name in the executable file.

These performance statistics are in compact form and first must be converted to a readable format. This is done by running Profiler, provided as part of your Micro Focus COBOL system.

14.1 Invoking the Profiler Program

To run Profiler, enter a command line of the form:

cobprof filenames directives

where the parameters are:

filenames One or more files containing compact Profiler output. Profiler always searches for a file with the extension .ipf; if you specify any other extension, it is ignored. If you profile more than one program at one time, Profiler output for all programs is appended to the output file for the first program, that is filename1.prf.
directives One or more of the directives that control the operation of Profiler. To specify a directive to Profiler, you must precede it with a plus sign (+). Each directive can be preceded by a plus sign, but only one is required at the start of a list of directives.

Directives must be separated by one or more spaces. Where a Profiler directive takes a parameter, you can enclose the parameter either in quotation marks or in parentheses. If you use either of these, however, you must escape them using the backslash character ( \).

Descriptions of the available Profiler directives are contained in the section Directives for Profiler.

14.2 Profiler Output

When you run Profiler, the following banner is displayed:

* Micro Focus COBOL for UNIX Profiler Vv.r
* Copyright (c) 19nn Micro Focus Ltd.
* name-1
.
.
.
* name-n

where name is one of the names in file list in the command line.

For example, if you submit a program prog1 to the cob command with the PROFILE directive, run the program, and then enter:

cobprof prog1 +LIST

the following output is produced on the console:

* Micro Focus COBOL for UNIX Profiler Vv.r 
* Copyright (c) 19nn Micro Focus Ltd. 
* prog1
 Total time: 172 milliseconds. Module called once.

%time   time    entries  ms/entry    paragraph
------------------------------------------------------------
64.53   111     21       5           TEST-ROUTINE
17.44   30      1        30          PARA1
16.28   28      15       2           NAME-ENTRY
1.74    3       1        3           END-SECTION
0.00    0       1        0         INITIAL(UNNAMED) PARAGRAPH

The Profiler output gives the total execution time (in milliseconds) for the program run and then breaks this down for each section and paragraph in the program as follows:

Output
Description
%time total percentage of execution time spent in the named section or paragraph
time total time (in milliseconds) spent in the named section or paragraph
entries number of times the named section or paragraph was entered
ms/entry average time (in milliseconds) per entry to the section or paragraph
paragraph section or paragraph to which performance statistics apply. The initial (unnamed) paragraph listed is the initialization code executed before the user part of the program is entered.

The product of the ms/entry and the number of entries should equal the total time spent in the section or paragraph; however, because all three values are truncated, there can be a slight discrepancy.

14.3 Directives for Profiler

This section lists and describes the Profiler directives you can use to control the behavior of the COBOL Profiler.

To specify a directive to the Profiler, you must precede it with a plus sign (+). Each directive can be preceded by a plus sign, but only one is required at the start of a list of directives. Directives must be separated by one or more spaces. Where a Profiler directive takes a parameter, you can enclose the parameter either in quotation marks or in parentheses. If you use either of these, however, you must escape them using the backslash character (\).

14.3.1 Descriptions of Directives

Descriptions of the Profiler directives appear alphabetically.


ALL

Outputs a full performance profile . If you do not set the ALL directive, no statistics are produced for sections or paragraphs that are not entered or PERFORMed.


ALPHA

Outputs performance statistics in alphabetical order by paragraph name. If you do not specify ALPHA, statistics are output in descending order of the total percentage time spent in each paragraph.


FORM"integer"

Specifies the default page size in lines for the listing file. The minimum value you should specify is 6. The default size is 60 lines.


LIST["destination"]

Specifies where the listing is to be produced. The possible values of destination are:

If destination is not specified, then the output is sent to the console, with page headings and page throws omitted. The VERBOSE Profiler directive also is set automatically.

If destination is specified with a filename, then the output is written to that file.

If you do not set the LIST Profiler directive, then by default the output is produced in a file called filename.prf, where filename is the first name in file list in the command line.


[NO]VERBOSE

Displays on the screen messages output by Profiler. The default setting is NOVERBOSE, unless the LIST directive is set without a specified parameter, in which case VERBOSE is set automatically.


WIDE

Allows lines in the Profiler output to be up to 131 characters wide. If the WIDE directive is not set, lines are truncated to 79 characters.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousDescriptions of Run-time Switches Terminfo Database and Terminal DevicesNext"