This chapter describes the Profiler utility.
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 utility, you can specify the PROFILE Compiler directive. This causes the Compiler to include code in your program that produces 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. See the chapter COBOL System Interface (Cob) in your User's Guide for information on the Cob utility.
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, using Profiler.
You can run Profiler from the SDE or from the command line.
To run Profiler from the SDE, press F5=profiler on the SDE Alternate menu.
To run Profiler from the command line, enter:
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. |
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 (+). You can precede each directive with a
plus sign; alternatively, you can specify one 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. |
Profiler creates a file with the extension .prf, with the same
basename as the .ipf file. 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.
When you run Profiler, the following banner is displayed:
* Micro Focus Server Express Profiler Vv.r * Copyright (c) 19nn Micro Focus International Ltd. * filename-1 . . . * filename-n
where filename
is one of the files listed in filenames
in the command line.
For example, if you submit the program prog1 to the Cob utility with the PROFILE directive set, run the program, and then enter:
cobprof prog1 +LIST
the following output is produced on the console:
* Micro Focus Server Express Profiler Vv.r * Copyright (c) 19nn Micro Focus International 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:
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.
How the run-time system treats the time spent in a called COBOL program that has been compiled with the PROFILE directive (a profiled program) depends on the value of the profile_behavior run-time tunable. You specify this tunable when you run the program that you want to be profiled.
If the profile_behavior run-time tunable is set to 0 (the default), then time spent in a profiled called program is recorded both in the called program and in the calling program.
If the profile_behavior run-time tunable is set to1, then time spent in a profiled called program is recorded only in the called program.
For example, suppose program prog_a calls program prog_c. prog_a is a profiled COBOL program. Then:
If prog_a actually calls prog_b, which calls prog_c, and prog_b is not a profiled COBOL program, then time in prog_b is always recorded in prog_a, while time in prog_c is recorded as explained above.
For a description of the profile_behavior run-time tunable see the section Run-time Tunables in the chapter Run-time Configuration in your User's Guide.
This section lists and describes the Profiler directives you can use to control the behavior of the COBOL Profiler.
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.
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.
Specifies the page size in lines for the listing file. The minimum value you should specify is 6. The default size is 60 lines.
Specifies where the listing is to be produced.
If destination
is specified, the output is written to that file.
If destination
is not specified, then the output is sent to the console, with page
headings and page throws omitted. The VERBOSE Profiler directive is also set
automatically.
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 the files listed on the command line.
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.
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 © 2004 Micro Focus International Limited. All rights reserved.