prof(1) CLIX prof(1)
NAME
prof - Displays profile data
SYNOPSIS
prof [-tcan] [-ox] [-g] [-z] [-h] [-s] [-m mdata] [prog]
FLAGS
The mutually exclusive flags -t, -c, -a, and -n determine the type of
sorting of the output lines:
-t Sort by decreasing percentage of total time (default).
-c Sort by decreasing number of calls.
-a Sort by increasing symbol address.
-n Sort lexically by symbol name.
The mutually exclusive flags -o and -x specify the displaying of the
address of each symbol monitored:
-o Display each symbol address (in octal) along with the symbol name.
-x Display each symbol address (in hexadecimal) along with the symbol
name.
The following flags may be used in any combination:
-g Include nonglobal symbols (static functions).
-z Include all symbols in the profile range (see monitor(3)), even
if associated with zero number of calls and zero time.
-h Suppress the heading normally displayed on the report. (This
is useful if the report is to be processed further.)
-s Display a summary of several of the monitoring parameters and
statistics on stderr.
-m mdata Use the mdata file instead of mon.out as the input profile
file.
DESCRIPTION
The prof command interprets a profile file produced by the monitor()
function. The symbol table in the prog object file (a.out by default) is
read and correlated with a profile file (mon.out by default). For each
external text symbol the percentage of time spent executing between the
2/94 - Intergraph Corporation 1
prof(1) CLIX prof(1)
address of that symbol and the address of the next is displayed, together
with the number of times that function was called and the average number
of milliseconds per call.
A program creates a profile file if it has been loaded with the -p flag of
cc. This flag to the cc command arranges for calls to the monitor command
at the beginning and end of execution. It is the call to monitor at the
end of execution that causes a profile file to be written. The number of
calls to a function is tallied if the -p flag was used when the file
containing the function was compiled.
The name of the file created by a profiled program is controlled by the
environment variable $PROFDIR. If does not exist, mon.out is produced in
the directory that is current when the program terminates. If
$PROFDIR=string, then string/pid.progname is produced, where progname
consists of argv[0] with any path prefix removed, and pid is the program's
process ID. If it is the null string, no profiling output is produced.
A single function may be split into subfunctions for profiling by means of
the macro (see prof(0)).
FILES
mon.out for profile
a.out for namelist
NOTES
Only programs that call the exit command or return from main will cause a
profile file to be produced, unless a final call to monitor is explicitly
coded.
The use of the -p flag to the cc command to invoke profiling imposes a
limit of 600 (300 on the PDP-11) on functions that may have call counters
established during program execution. For more counters you must call
monitor directly. If this limit is exceeded, other data will be
overwritten and the mon.out file will be corrupted. The number of call
counters used will be reported automatically by the prof command whenever
the number exceeds 5/6 of the maximum.
CAUTIONS
The times reported in successive identical runs may show variances of 20%
or more because of varying cache-hit ratios, due to sharing of the cache
with other processes. Even if a program seems to be the only one using
the machine, hidden background or asynchronous processes may blur the
data. In rare cases, the clock ticks initiating recording of the program
counter may ``beat'' with loops in a program, grossly distorting
measurements.
2 Intergraph Corporation - 2/94
prof(1) CLIX prof(1)
Call counts are always recorded precisely.
The times for static functions are attributed to the preceding external
text symbol if the -g flag is not used. However, the call counts for the
preceding function are still correct; that is, the static function call
counts are not added in with the call counts of the external function.
RELATED INFORMATION
Commands: acc(1), cc(1)
Functions: exit(2), profile(2), monitor(3)
Files: prof(0)
2/94 - Intergraph Corporation 3