HP 3000 Manuals

The COBOL Profiler [ COBOL/HP-UX Operating Guide for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Operating Guide for the Series 700 and 800

The COBOL Profiler 

The COBOL Profiler is a facility that allows 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 Chapter 2
, COBOL System Interface 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 relating to each paragraph of the program each
time you run the compiled program.  Note that if your program contains no
paragraphs, this report will not be 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 the Profiler,
which is provided as part of your Micro Focus COBOL system.

Invoking the Profiler Program 

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

cobprof file-names directives

where:

file-names           are one or more files containing compact profiler
                     output.  Specify the program name without the .ipf
                     file extension.  If you profile more than one
                     program at one time, the Profiler output for all
                     programs is appended to the output file for the
                     first program, that is file-name1.prf.

directives           are one or more of the directives that control the
                     operation of the Profiler.  To specify a directive
                     to the profiler, you must precede it with a plus
                     sign (+).  Each directive may be preceeded 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
Appendix H  Directives for Profiler.

Profiler Output 

When you run the Profiler, the following banner is displayed:

     * Micro Focus COBOL for UNIX Profiler Vv.r
     * Copyright (c) 1992 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 will be produced on the console:

     * Micro Focus COBOL for UNIX Profiler Vn.n
     * Copyright (c) 1992 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:

%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 may be a slight discrepancy.



MPE/iX 5.0 Documentation