2. General Operation
Using MAINPM typically entails the following steps:
-
Compile the MODULEs whose performance you wish to monitor.
Depending on the kind of monitoring you want to do, you
may have to give special compiler subcommands.
-
Run the MODULE MAINPM.
-
Issue MAINPM commands that tell MAINPM what to monitor.
Some kinds of monitoring require no MAINPM commands;
i.e., they are done by default for MODULEs that were
compiled with the appropriate subcommands.
-
Run your program from MAINPM, using MAINPM's EXECUTE command.
-
When your program returns to MAINPM,
generate a report containing the statistics that MAINPM collected
during the execution of your program.
-
Examine the report to see where your program's performance can
be improved.
2.1. Compiling MODULEs to Be Monitored
To use MAINPM, first compile the MODULEs you
wish to monitor.
If the kinds of monitoring you want require
special subcommands,
specify the kinds of monitoring you want
done by means of the compiler subcommands listed in
Table 3–2.
Compiler subcommands can be combined if more than one kind of
monitoring is desired.
The compiler subcommands shown in Table 3–2
are sticky; i.e., they apply
by default to subsequent MODULEs compiled in the same compiler
session.
See Chapter 4 of the MAINSAIL Compiler User's Guide for more information.
Typically, when a MODULE is compiled with special subcommands,
the resulting object MODULE is
larger and slower than its unmonitored counterpart.
2.2. Running MAINPM, Issuing MAINPM Commands, Running Your
Program from MAINPM, and Getting a Listing
After compiling all the MODULEs to be
monitored, execute MAINPM. Using commands to MAINPM:
-
Specify the kinds of monitoring to be performed.
See Table 3–2.
In the column labeled “Pre-Execution MAINPM Commands”,
the entry “none”
means that this kind of monitoring is done by default for
an appropriately compiled MODULE
(you can change the defaults to turn off this kind of
monitoring, if desired).
-
For some kinds of monitoring (SPACE and TRACECHUNKS),
you may want to specify which MODULEs are to be monitored
(using the default lists of MODULEs to be monitored for
these commands is often satisfactory, however).
If you do wish to specify which MODULEs are to be monitored,
use the {NO}MONITORMODULE and
{NO}MONITORLIB commands.
For SPACE and TRACECHUNKS,
you can also specify which areas are to
be monitored using {NO}MONITORAREA;
however, the default (monitor all areas) is often useful.
-
Execute the program of which the MODULEs are a part. As the program
executes, the MAINSAIL runtime system gathers statistics about the
monitored MODULEs and writes the information to a data file.
When the program
finishes, control reverts to MAINPM.
-
Issue the MAINPM LIST command to process the data file
and produce a text file.
This text file is a listing containing the information you requested.
The format of the file is supposed to be more or less self-explanatory,
although this document does contain some examples with explanations.
Note that
more than one kind of monitoring may be done at a time,
and different kinds
of monitoring may be done for different MODULEs during the same
execution of a program.