PROF++(1) — USER COMMANDS
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)).
If the function name is a C++ mangled symbol, prof++ will print out its demangled format. All mangled C++ symbols are bracketed by [ ] following the demangled symbol. For regular mangled C++ function names (including member and non-member functions), function prototype is used as its demangled format. For example, ___ct__13Iostream_initFv is printed as:
Iostream_init::Iostream_init().
C++ static constructors and destructors are demangled and printed in the following format:
static constructor function for <file_name>
or
static destructor function for <file_name>.
For example, ___std_____stream_in_c___Fv is demangled as static destructor function for ___stream_in_c.
For C++ virtual table symbols, its mangled name takes the following format:
___vtbl__<class>
___vtbl__<root_class>__<derived_class>
In the prof++ output, the demangled names for the virtual table symbols are printed as
virtual table for <class>
virtual table for class <derived_class> derived from <root_class>
For example, the demangled format of
___vtbl__7fstream
is
virtual table for fstream
and the demangled format of
___vtbl__3ios__18ostream_withassign
is
virtual table for class ostream_withassign derived from ios.
Some C++ symbols are pointers to the virtual tables, their mangled names take the following format:
___ptbl__<class>___<Filename>
___ptbl__<root_class>__<derived_class>___<Filename>
In the prof++ output, the demangled names for these symbols are printed as:
pointer to virtual table for <class> in <Filename>
pointer to virtual table for class <derived class> derived from <root_class> in <Filename>
For example, the demangled format of
___ptbl__3ios_____stream_fstream_c
is
pointer to the virtual table for ios in __stream_fstream_c
and the demangled format of
___ptbl__3ios__11fstreambase_____stream_fstream_c
is
pointer to the virtual table for class fstreambase derived from ios in ___stream_fstream_c
Beware of quantization errors.
The profiled program must call exit(2) 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
gprof(1), gprof++(1), tcov(1), plot(1G), cc(1V), exit(2), profil(2), monitor(3)
NOTE
Some C++ symbols contain file name information. SunOS file name path can contain characters (such as ‘.’ and ‘/’) that cannot be used to encode assembler symbols. Those characters are transformed into ‘_’. For example, ../stream_io.c is represented as ___stream_io_c in C++ mangled symbol. prof++ does not second-guess or demangle ‘_’ in the file name path string.
LIMITATIONS
The demangling scheme will not handle the functions that take more than 35 arguments.
BUGS
prof++ is confused by the FORTRAN compiler which puts the entry points at the bottom of subroutines and functions.
Sun Release 4.0 — Last change: 20 July 1989