prof Command Purpose Displays object file profile data. Syntax prof [ -t | -c | -a | -n ] [ -o | -x ] [ -g ] [ -z ] [ -h ] [ -s ] [ -S ] [ -v ] [ -L PathName ] [ Program ] [ -m MonitorData ... ] Description The prof command interprets profile data collected by the monitor subroutine for the object file Program (a.out by default). It reads the symbol table in the object file Program and correlates it with the profile file (mon.out by default). The prof command displays, for each external text symbol, the percentage of execu- tion time spent between the address of that symbol and the ad- dress of the next, the number of times that function was called, and the average number of milliseconds per call. For the number of calls to a function to be tallied, you must have compiled the file using the -p flag of the cc command. The -p option causes the compiler to insert a call to the mcount sub- routine into the object code generated for each recompiled func- tion of your program. During program execution, each time a parent calls a child function the child calls the mcount subrou- tine to increment a distinct counter for that parent-child pair. Programs not recompiled with the -p option do not have the mcount subroutine inserted, and therefore keep no record of who called them. This flag also arranges for the object file to include a special profiling startup function that calls the monitor subroutine at the beginning and end of execution. It is the call to the moni- tor subroutine at the end of execution that writes the mon.out file. Thus, only programs that explicitly exit or return from the main program cause the mon.out file to be produced. The location and names of the objects loaded are stored in the mon.out file. If you do not select any flags, prof will use these names. You must specify a program or use the -L option to access other objects. Note: Imported external routine calls, such as a call to a shared library routine, have an intermediate call to local glink code that sets up the call to the actual routine. If the timer clock goes off while executing this code, time will be charged to a routine called routine.gl, where routine is the routine being called. For example, if time is charged to the routine printf.gl, then the timer went off while in the glink code to call the printf subroutine. Flags The mutually exclusive flags a, c, n, and t determine how the prof command sorts the output lines: -a Sorts by increasing symbol address. -c Sorts by decreasing number of calls. -n Sorts lexically by symbol name. -t Sorts by decreasing percentage of total time (default). Note: The prof command can still execute successfully if you use more than one of flags a, c, n, and t in the same command. The prof command accepts the first of these flags it encounters on the command line and ignores the others. The mutually exclusive flags o and x specify how to display the address of each symbol monitored. -o Displays each address in octal, along with the symbol name. -x Displays each address in hexadecimal, along with the symbol name. Note: The prof command can still execute successfully if you use both the -o and -x flags in the same command. The prof command accepts the first of these two flags it encounters on the command line and ignores the other flag. Use the following flags in any combination: -g Includes non-global symbols (static functions). This option requires object code that was compiled with the -g flag. -h Suppresses the heading normally displayed on the report. This is useful if the report is to be processed further. -L PathName Uses alternate pathname for locating shared objects. -m MonitorData Takes profiling data from MonitorData instead of mon.out. -s Produces a summary file in mon.sum. This is useful when more than one profile file is specified. -S Displays a summary of monitoring parameters and statistics on standard error. -v Suppresses all printing and produces a graphic version of the profile on the standard output for display by the plot filters. When plotting, the numbers low and high, by default 0 and 100, may be given to cause a selected percentage of the profile to be plotted with accordingly higher resolution. -z Includes all symbols in the profile range, even if associated with zero calls and zero time. Examples 1. To display, without a header, the amount of time spent at each symbol address, sorted by time, enter: prof -t -h 2. The following example obtains a local version of any shared libraries used to create runfile in the directory /home/score/lib. The data file used will be runfile.mon rather than mon.out. prof -x -L/home/score/lib runfile -m runfile.mon Implementation Specifics This command is part of Base Profiling Support in Application Development Toolkit. Files mon.out Default profile. a.out Default object file. mon.sum Summary profile. Related Information The cc command, nm command, gprof command. The exit subroutine, profil subroutine, monitor subroutine. The Commands Overview in AIX Version 3.2 System User's Guide: Base and Devices. The Subroutines Overview in AIX Version 3.2 General Programming Concepts. XL C User's Guide. XL FORTRAN Compiler/6000 User's Guide. XL Pascal Compiler/6000 User's Guide. User's Guide for VS COBOL Compiler/6000.