5. Graphical Performance Monitor
Selecting Execution->Monitor...
brings up the MAINSAIL Monitor window.
From this window, you can invoke several monitoring utilities that
display changes in the state of MAINSAIL's memory as they occur.
These utilities are graphical versions of features in MAINPM and MM,
but MAINPM and MM can provide only snapshots of a particular instant
in a program's execution, as opposed to “movies” that show changes as
they happen.
Some of the facilities described here are available only if you have
purchased MAINPM.
Figure 5–1. MAINSAIL Monitor Window
The controls in the MAINSAIL Monitor window are:
-
Module, Library, and Area monitoring:
Lists MODULEs, libraries, and areas to monitor or not to monitor.
This list affects the Monitor Proc Chunk/String/Static Allocation
displays and the Trace Chunks report.
If there are items to monitor, only they are monitored, and items of
the same type marked as not to monitor are ignored;
otherwise, all items are monitored except those marked as not to
monitor.
-
Delete Selected Items, Add Items...:
Delete Selected Items deletes any selected items from the
Module, Library, and Area monitoring list.
Add Items... brings up the Add Monitoring Items window,
which lets you add to the
Module, Library, and Area monitoring list.
In the Add Monitoring Items window,
you can type the name of a MODULE, objmod library, or area in the
text widget.
If you need to be reminded of the open library names or existing area
names, you can click
Show Open Libraries or Show Current Areas
in the MAINSAIL Monitor
window.
You need to select Monitor or Don't Monitor
to tell which list to
add the name to, and Module, Library,
or Area to tell what kind of
thing the name belongs to.
Figure 5–2. Add Monitoring Items Window
-
Monitoring buttons (Monitor Memory Pages, etc.):
Each of these brings up a different monitoring window,
as described below.
If a button is already depressed, clicking it again makes the
monitoring window go away;
you can also make the individual monitoring windows go away by clicking
their Close or Exit buttons.
-
Show Open Libraries, Show Current Areas:
Information about the current MAINSAIL session.
Useful for selecting text to paste into the Add Monitoring Items
window.
5.1. Monitor Memory Pages
This brings up the Memory Map window,
which displays a page map of the current MAINSAIL process's memory.
The menu bar in this window also lets you issue the same commands
provided by the utility MM
(see Chapter 23 of the MAINSAIL Utilities User's Guide
for a complete description of MM).
Figure 5–3. Memory Map Window
The controls in the Memory Map window are:
-
The widget full of colored (or shaded, on a monochrome screen) boxes
at the top is the page map itself.
One page is shown per cell; the color depends on how the page is
allocated.
-
The histogram below the map gives counts for each page type, and also
acts as a key to the colors or shadings used in the map (each bar is
colored the same way as the corresponding cells in the map).
-
On systems with shared libraries, the shared library page count tells
how many pages' worth of object libraries have been mapped into
MAINSAIL's address space.
These pages do not show up in the page map, since shared library
pages are normally allocated far away from other MAINSAIL memory.
On systems without shared libraries,
each object MODULE from an open
library must be read into the page map as control pages,
as are MODULEs
from individual object MODULE files on every system.
-
On systems with shared libraries, MAINSAIL often comes up with the
control page count equal to zero,
since all the default MODULEs shipped
with MAINSAIL are located in libraries.
-
The Cell Size control
lets you control the size of the square cells in
map; the dimension controlled is in pixels. The default size for a
cell is 8 by 8.
Smaller cell sizes let you fit more pages on the map, but the map is
harder to read.
-
If you click on a page within the map above,
the Click on page to identify page box shows the starting
address of the page and how the
page is allocated.
Chunk and STRING pages tell you what area the page is for.
Control pages tell you what MODULE the page is for.
-
The Program Interaction Area displays messages from some of the
commands available through the menu bar at the top of the Memory Map
window.
A sash allows the Program Interaction Area to be sized.
The items on the main menu bar correspond to MM commands.
Consult the description of MM
in Chapter 23 of the MAINSAIL Utilities User's Guide
for detailed descriptions of each command.
Figure 5–4. The Memory Management Menu
Under the Memory Management menu,
items correspond to MM commands as
follows:
-
Collect pointers:
CP.
-
Collect strings:
CS.
-
Collect pointers and strings:
CPS.
-
Collect dscrArea:
CDA.
-
Compact chunk space:
CCS.
-
Coalesce free chunks:
CFC.
-
Check memory consistency:
CMC.
-
Compress memory down:
CMD.
-
Compress memory up:
CMU.
-
Deallocate trailing free pages:
DP.
-
Swap out indicated module...:
SW s. Prompts for s (name of MODULE to swap out).
-
Swap out a module of MAINSAIL's choice:
SWI.
-
Swap out all modules:
SWA.
Figure 5–5. The Settings Menu
Under the Settings menu, items correspond to MM commands as
follows:
-
Set $allowedMemoryPercent...:
AMP n. Prompts for n (new value).
-
Set $collectMemoryPercent...:
CMP n. Prompts for n (new value).
-
Increment $collectLock:
IC.
-
Decrement $collectLock:
DC.
-
Set $overheadPercentExitValue...:
OPEV n. Prompts for n (new value).
Figure 5–6. The Info Menu
Except as specified below,
all items on the Info menu bring
up a dialog box that prompts for an
output file name.
If you specify the file name TTY,
output goes to the CMDLOG window;
otherwise, it goes to the file named.
Under the Info menu, items correspond to MM commands as
follows:
-
Write array info...:
AI f.
-
Write all stats info...:
ALL f.
-
Write area info...:
ARI f.
-
Write chunk info...:
CI f c1 ... cn.
Specify a file name,
optionally followed by one or more CLASS names.
If the CLASS names are specified,
write the contents of all objects
of those CLASSes.
Always write a table summarizing information about all objects.
-
Write class info...:
CLI f.
-
Write descriptor info...:
DI f.
-
Fix ref info...:
FR f g.
Prompts for f (the file to be fixed)
followed by g (the final output
file).
-
Write configuration info...:
I f.
-
Write memory map...:
M f.
-
Write module age info...:
MAI f.
-
Write module info...:
MI f.
-
Write ref info...:
RI f a1 ... an.
Prompts for an output file name followed by one or more area titles.
5.2. Monitor Proc Pcs
Brings up the Procedure Pcs window.
Starting the first time the Procedure Pcs window is displayed,
periodically interrupts MAINSAIL
to see which PROCEDURE is executing,
and adds one to that PROCEDURE's
count.
Maintains a histogram of PROCEDURE counts, most frequently called
PROCEDURE at the top, so you can see which
PROCEDUREs are taking
the most time.
If a MODULE is disposed (i.e., by the
MODULE or STRING form of dispose,
so that the control section is released),
the MODULE's PROCEDUREs eventually disappear from the display;
the display is just for currently executing MODULEs.
Figure 5–7. Procedure Pcs Window
5.3. Monitor Allocated Classes
Brings up the Allocated Records and DataSecs window,
which displays a
histogram of the number of dynamic records
of each CLASS and data sections
of each MODULE currently in memory,
with the most numerous objects at the top.
This lets you see the kinds of dynamic records
and data sections that your
program uses the most.
Figure 5–8. Allocated Records and DataSecs Window
5.4. Monitor Collected Classes
Brings up the Garbage Collected Records and DataSecs window,
which displays a
histogram of the number of dynamic records of each CLASS
and data sections
of each MODULE that have been garbage collected since the window
was first displayed.
The most numerous objects are shown at the top.
This lets you see what kinds of dynamic records
and data sections become garbage
most frequently in your program.
Clicking on Garbage Collect Chunks causes an immediate chunk
collection.
Clicking on Reset resets the count
associated with each CLASS and
MODULE to zero.
Figure 5–9. Garbage Collected Records and DataSecs Window
5.5. Monitor Proc Chunk Allocation,
Monitor Proc String Allocation, and
Monitor Proc Static Allocation
These three buttons bring up three similar windows:
Chunk Space Allocated by Proc,
String Space Allocated by Proc, and
Static Space Allocated by Proc.
Each window shows a histogram of the number of bytes allocated by
each monitored PROCEDURE
(monitored PROCEDUREs are controlled by
the monitored MODULE list in the MAINSAIL Monitor window).
These windows let you see which PROCEDUREs in your program are
allocating the most memory.
If a MODULE is disposed (i.e., by the
MODULE or STRING form of dispose,
so that the control section is released),
the MODULE's PROCEDUREs eventually disappear from the display;
the display is just for currently executing MODULEs.
If your program is compiled debuggable, the information in these
windows may not be very reliable, since the data browser allocates
substantial amounts of memory, but this memory will be charged to
your program by default, since the debugger is in a library that is
not monitored by default.
The Reset button sets the counts
associated with each PROCEDURE to
zero.
Figure 5–10. Chunk Space Allocated by Proc Window
5.6. Trace Chunks
Starts tracing chunks. This does not display information graphically,
but displays an information box telling you that it has started
tracing chunks.
When you toggle the Trace Chunks button,
prompts for a file name to which to write the chunk trace listing.
The format of this file is described in Chapter 7 of the MAINPM User's Guide.