Object COBOL Development Environment Menu System | Animator |
Analyzer and GNT Analyzer are tools for creating a statistical execution profile when a program, or suite of programs, is being tested or run.
Analyzer is both a stand-alone tool and an integrated component of Advanced Animator and Animator V2.
GNT Analyzer is a stand-alone tool, but you can view its results in either Advanced Animator or Animator V2.
Both Analyzer and GNT Analyzer provide execution profiles of programs compiled with the COBOL Compiler. They can be run several times against different test data, accumulating statistics each time they are run.
Analyzing your programs enables you to identify those statements in your COBOL program that have not been executed in a series of test runs as well as those areas of code which are most often executed. With this information you can pinpoint areas of code which would most benefit from further testing or program optimization.
While Analyzer and GNT Analyzer both provide performance statistics, they are designed to meet different needs. Depending upon the type of program analysis you want, you might want to use either or both of these tools. The relative advantages of Analyzer and GNT Analyzer are described in the section below.
Analyzer is designed to work on intermediate code (.int) files. You could think of it as the INT Analyzer. Analyzer provides simple count information on the number of times each COBOL statement is executed. You can choose to have the count information provided as a printed report (.anl) file or in an information (.idy) file. You can view the .idy file in Analyzer, Advanced Animator or Animator V2. You can also view the count information using CSI.
You can run Analyzer in batch mode from the command line, or you can access it from Advanced Animator. If you run Analyzer in batch mode, the count information is provided at the end of the analysis. If you run Analyzer from Advanced Animator, Analyzer is interactive, so you can see the statement count being updated as your program is executed. Because it is fully integrated with Advanced Animator, you can also view the analysis on screen using color, graphs and scaling, and you can find the next unexecuted statement.
GNT Analyzer works on intermediate code (.int) files and generated code (.gnt) files. If you are running under DOS, Windows or OS/2, you can also use GNT Analyzer on object code (.obj) files linked with the shared run-time system.
GNT Analyzer enables you to obtain more comprehensive code coverage statistics using the GNL utility. These statistics are stored in a .gnl file. You can choose to have the statistics in this file provided as a printed report (.anl) file or transferred into an information (.idy) file. You can view the .gnl file in the GNL utility. Alternatively, when you have transferred the results into the .idy file, you can use the INT analyzer or CSI to view the results.
GNT Analyzer runs only in batch mode, so you can only see the finished analysis. However, since the application runs at almost full speed, you get the results of the analysis more quickly.
Figure 3-1 illustrates how Analyzer and GNT Analyzer provide program statistics.
Figure 3-1: Comparison of Analyzer and GNT Analyzer
The following sections describe how to invoke and use Analyzer and GNT Analyzer.
This section describes how to prepare your program for analysis, and how to invoke Analyzer. You can control the way in which Analyzer behaves by setting directives on the command line, or by selecting options from within Advanced Animator.
Before you can obtain an analysis of program execution, you must prepare the program for analysis. You do this by compiling your program with the ANALYZE directive set.
You can select specific programs in a suite of programs for program analysis. Analyzer operates only on those compiled for analysis; all other programs in a suite undergo the normal execution process.
You invoke Analyzer from the Workbench or Object COBOL menu system (use the option labelled "Analyzer"), from the system prompt, or from the menu in Advanced Animator. In the first two cases, directives control the behavior of Analyzer.
DOS and OS/2:
The command line used to invoke Analyzer for DOS and OS/2 is:
wb analyze program-name [directives]...
Windows:
The command line used to invoke Analyzer for Windows is:
wbw analyze program-name [directives]...
See the section Invoking Workbench Components in the chapter Introduction for more information. Also, refer to your Windows documentation.
UNIX :
The command line used to invoke Analyzer for UNIX is:
analyze program-name [directives]...
The optional directives are described in the section Analyzer Directives later in this chapter.
You can switch on Analyzer and change its mode of display from the Alt menu in Advanced Animator.
This menu, shown in Figure 3-2, is accessed by holding the Alternate key down when viewing the main Animate menu.
Figure 3-2: Animator Alternate Menu
The Alt menu provides access to both the facilities of Analyzer and Structure Animator. Structure Animator is described in the chapter Structure Animator. This menu also provides alternative display options for both Structure Animator and Analyzer.
Switch Analyzer on by pressing Alt+F2. The menu shown in Figure 3-3 is displayed.
Figure 3-3: Analyzer Main Menu
When Analyzer is turned on, the first entry on the information line changes from "Animate" to "Analyze." The word "Scale" appears on the information line; its initial setting is 001. This refers to the sensitivity of the graphical and color display of the counts: a scale setting of one means that, for example, the color changes as each statement count increments by one.
Turning Analyzer on also causes either numeric figures or symbols to appear on the right side of your screen. This information displays the number of times each statement has been executed. Hyphens representing zero indicate those statements not yet executed.
As you Step, Go or Zoom through your program, each statement's counters increase by 1 each time that statement is executed.
When Analyzer is turned off, the indicators at the right side of the screen disappear. The information line reverts back to the Animator menu. Counting is suspended. However, the statement counts are saved and can be re-displayed by turning Analyzer on again.
Press Alt+F6 (press the Alt key to display the Alternate Options menu, then F6=display) to see the Analyzer Display Options menu shown in Figure 3-4.
Figure 3-4: Analyzer Display Options Menu
The options on this menu let you modify your display.
This toggle switches the display of the statement execution count between numeric figures and graphic symbols. The figures option causes the display of numeric figures; this is the default setting. The graph option displays a bar chart consisting of a line of asterisks. One asterisk is displayed for each scale threshold reached, so the display is modified by the scale up/down function. Once the display area is full, no more asterisks are displayed as the execution count increases.
The color of each line of source code is set according to the number of times it has been executed. This function is modified by the scale up/down function (the color changes when a scale threshold is reached).
The scale up and scale down options affect the graph and color options. Scale down causes the scale value to double each time you execute it. The maximum scale value is 128. The scale up option causes the scale value to divide in half until it reaches a minimum of 1. The color changes with steps of 1, 2, 4, 8, ... in the execution count depending on the current scale value. In the graph each asterisk represents 1, 2, 4, 8, ... executions depending on the current scale value.
The Find Next function moves the cursor to the next statement after the current cursor position that has not been executed. Access it by pressing Ctrl+F2. Notice that the count is zero. You can also use facilities in COBOL Source Information to perform this function.
To reset all the counters, press Ctrl+F4 (press the Ctrl key to display the Control Options menu and then press F4=clear).
This function initializes all the execution counts of your program. The prompt shown in Figure 3-5 appears.
Figure 3-5: Analyzer Reset Counters Menu
N (No) clears the counters for the current program only. Y (Yes) clears the counters for any other programs currently in memory that were compiled using the ANALYZE directive.
Analyzer automatically records the results of your analysis in the Animator information (.idy) file. The next time you invoke the program and use Analyzer, the indicators appear on the screen.
If you select the print function (Alt+F7) when you have Analyzer active, you can print the source listing with the analyzer count included. The print is started when you select pause-at-new-page or no-pause.
Figure 3-6: Animator Print Menu
The output file is called program-name.anl. This file reproduces your source code, adding a number representing the execution count for the statement contained on that line. This is positioned on the right hand side. Where your original source code contains multiple statements on a line, the report splits these statements up so that each line contains only one statement and one execution count.
This option cancels the printing of your analysis. It is effective only when you are in the process of printing.
This option causes the results output file to be created one page at a time.
The option causes the results output file to be created.
You can specify certain directives to control the analysis of your program when you invoke it on the command line.
Default: NOCLEAR
Clears all previous counts before beginning analysis.
Default: COUNT
Adds 1 to the count each time the statement is executed. NOCOUNT simply give a coverage analysis.
Specifies the end of Analyzer directives. Any further text on the command line is available to the program via the ACCEPT...FROM COMMAND-LINE statement.
Default: NOPRINT
Produces printed results of each program that was analyzed in the program suite. The printout begins at the Procedure Division of each program. Analyzer divides a line containing more than one statement. The results of the count appear down the right-hand side of the printout. The name of the print file is program-name.anl.
This section describes how to prepare your program for analysis by GNT Analyzer and how to invoke the GNT Analyzer. The way in which the GNT Analyzer works is controlled by setting directives on the command line, and by the settings in a configuration file.
The basic steps in performing GNT analysis on your code are listed below.
More detailed information about these steps is provided in the remainder of this chapter.
The first step in the analysis is to compile your program using the GNTANLZ directive. This directive takes the form:
GNTANLZ(parameter)
where parameter
is:
TICK | Causes a bit to be set for each basic block executed. |
COUNT | Counts how often each basic block is executed. |
A basic block is a block of contiguous statements with no jumps. For example, a set of MOVE statements could be referred to as a basic block.
Compiling your program with the GNTANLZ directive inserts special code into the program you are compiling so that the coverage statistics can be collected.
The environment variable GNTANLZ is used to specify a configuration file. The configuration file is used to specify the GNT Analyzer options to be used for a file at run time. A default configuration file is supplied with the GNT Analyzer, called gntanlz.cfg. It has the standard MFCONFIG file format, with the tag GNTANLZ.
DOS, Windows and OS/2:
If you are using DOS, Windows or OS/2, set the environment variable using
the following:
set gntanlz=drive:
\cobol\lbr\gntanlz.cfg
UNIX:
If you are using UNIX, you would normally set the environment variable by
specifying the following:
GNTANLZ=/opt/lib/cobol/toolbox/gntanlz.cfg export GNTANLZ
Using the configuration file you can specify a number of options which are as follows:
The parameters with which you specify this information are described below:
The results of this test run are stored in filename
.
If ACCUMULATE follows the filename, results for multiple test runs are
accumulated in the file. Otherwise, separate runs generate separate files.
Determines whether or not the coverage summary should be echoed on the screen.
At the end of each run, the coverage summary is appended to the file that you specify. If no filename is specified, the coverage summary is automatically appended to the file gntanlz.log.
After you have tested your program using GNT Analyzer, a GNL file is produced. This file holds the results of the test. You can optionally specify that the following information is displayed for each program at the end of the test:
GNT Analyzer can produce results in two different ways. Separate result files can be output for each test run, or a single results file can accumulate results for multiple tests. The way in which results are calculated is determined by the setting of the RESULTS parameter in the GNT Analyzer configuration file. See the previous section GNT Configuration File for further information.
DOS, Windows and OS/2:
The results of a GNT analyze are held in the .gnl file. Workbench
provides the utility
gnl.exe which enables you to examine these results.
Run the utility from the command line using the following format:
gnl filename [directives]
Default: NOANALYZE
If the program was checked with the ANALYZE directive, this option patches the GNT Analyzer execution counts into the .idy file where they can be examined from Analyzer or CSI. (Note: COBOL Source Information has query facilities which enable you to locate code executed more or less than a specified number of times.)
Default: NOBLOCKNUM
Shows the basic block number of each statement in the right hand margin of the source listing. This directive is useful when you are debugging code.
Default: NOCALLS
Identifies the most commonly called subprograms. Called subprograms are listed alphabetically by name. The following information is provided for each subprogram:
It is useful to identify the most commonly called routines, as the call overhead in COBOL can be considerable. The program and subprograms must have been compiled with the CSI directive to use this program.
Default: NODATAFREQ
Computes the total number of times that each data item in the program is accessed. It also identifies misaligned 2-, 3- or 4-byte items. On 386 and 486 machines data alignment can have a high performance impact. Many 486 instructions execute in a 1 clock cycle, but misaligned data adds another three cycles, and so the instruction is four times slower to execute. Similar effects can be found on other chip architectures. An item is flagged as misaligned if it meets any of the following criteria:
The top 100 most frequently accessed data items are listed in descending order of frequency together with any misaligned data items. The program and subprogram must be compiled with CSI to use this option.
Default: NOECHO
Output is echoed to the console, as well as written to the .anl file.
Default: NOFULL
Turns on the directives DATAFREQ, CALLS, VERBS and PROFILEV
Default: NOPROFILE
Produces a bar graph showing peak and average execution count versus the source line. This enables you to quickly identify the most frequently executed areas in the program. The peak count is shown by a line and the average count is shown by a shaded block. PROFILE shows the execution count along the vertical axis. The PROFILE and PROFILEV directives are mutually exclusive.
Default: NOPROFILEV
Same as the PROFILE directive, except that PROFILEV shows the execution count along the horizontal axis. The PROFILE and PROFILEV directives are mutually exclusive.
A separate .anl file is produced for each separate program in the.gnl file. If you specify this directive, a single .anl file is produced. The .anl file has the same name as the .gnl file.
Default: SOURCE
A listing of the program is produced showing execution counts for each statement. This option is on by default and can be very time consuming.
Default: NOVERBS
Produces a breakdown of COBOL verb types. Three columns of information are produced, which provide the following information for each verb:
The list is sorted in descending order of execution count.
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Object COBOL Development Environment Menu System | Animator |