PROF(1)

NAME
prof - display profile data

SYNOPSIS
prof [ -alnsz ] [ -v -low [ -high ] ]
[ image-file [ profile-file ... ] ]

DESCRIPTION

prof produces an execution profile of a program. The profile data is taken from the profile file which is created by programs compiled with the -p option of cc(1V) and other compilers. That option also links in versions of the library routines (see monitor(3)) which are compiled for profiling. The symbol table in the executable image file image-file (a.out by default) is read and correlated with the profile file profile-file (mon.out by default). For each external symbol, the percentage of time spent executing between that symbol and the next is printed (in decreasing order), together with the number of times that routine was called and the number of milliseconds per call. If more than one profile file is specified, the prof output shows the sum of the profile information in the given profile files.

To tally the number of calls to a routine, the modules that make up the program must be compiled with the 'cc -p' option (see cc(1V)). This option also means that the profile file is produced automatically.

A single function may be split into subfunctions for profiling by means of the MARK macro (see prof(3)).

Beware of quantization errors.

The profiled program must call exit(2V) or return normally for the profiling information to be saved in the mon.out file.

OPTIONS

-a  Report all symbols rather than just external symbols.

-l  Sort the output by symbol value.

-n  Sort the output by number of calls.

-s  Produce a summary profile file in mon.sum. This is really only useful when more than one profile file is specified.

-z  Display routines which have zero usage (as indicated by call counts and accumulated time).

-v [ -low [ -high ]]
    Suppress all printing and produce a graphic version of the profile on the standard output for display by the plot(1G) filters. When plotting, the numbers low and high, (by default 0 and 100), select a percentage of the profile to be plotted, with accordingly higher resolution.

ENVIRONMENT

PROFDIR
    If this environment variable contains a value, place profiling output within that directory, in a file named pid.programname. pid is the process ID, and programname is the name of the program being profiled, as determined by removing any path prefix from the argv[0] with which the program was called. If the variable contains a NULL value, no profiling output is produced. Otherwise, profiling output is placed in the file mon.out.

FILES
a.out
    executable file containing namelist
$PROFDIR/pid.programname
mon.out
    profiling output
mon.sum
    summary profile

SEE ALSO
cc(1V), gprof(1), plot(1G), tcov(1), exit(2V), profil(2), monitor(3)

BUGS

prof is confused by the FORTRAN compiler which puts the entry points at the bottom of subroutines and functions.