Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > P


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


prof — display profile data


prof [-tcan] [-ox] [-g] [-z] [-h] [-s] [-m mdata] [prog]


prof interprets a profile file produced by monitor() (see monitor(3C)). The symbol table in the object file prog (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 address of that symbol and the address of the next is printed, together with the number of times that function was called and the average number of milliseconds per call.

The mutually exclusive options t, c, a, and n determine the type of sorting of the output lines:


Sort by decreasing percentage of total time (default).


Sort by decreasing number of calls.


Sort by increasing symbol address.


Sort by symbol name in ascending collation order (see Environment Variables below).

The mutually exclusive options o and x specify the printing of the address of each symbol monitored:


Print each symbol address (in octal) along with the symbol name.


Print each symbol address (in hexadecimal) along with the symbol name.

The following options can be used in any combination:


Include non-global symbols (static functions).


Include all symbols in the profile range (see monitor(3C)), even if associated with zero number of calls and zero time.


Suppress the heading normally printed on the report. (This is useful if the report is to be processed further.)


Print a summary of several of the monitoring parameters and statistics on the standard error output.

-m mdata

Use file mdata instead of mon.out as the input profile file.

A program creates a profile file if it has been loaded using the cc -p option (see cc_bundled(1)). This option to the cc command arranges for calls to monitor() at the beginning and end of execution (see monitor(3C)). It is the call to the monitor command 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 option 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 PROFDIR is not set, mon.out is produced in the directory current when the program terminates. If PROFDIR=string, 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 PROFDIR is set to a null string, no profiling output is produced.


Environment Variables

LC_COLLATE determines the collating order output by the -n option.

If LC_COLLATE is not specified in the environment or is set to the empty string, the value of LANG is used as a default. If LANG is not specified or is set to the empty string, a default of ``C'' (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, prof behaves as if all internationalization variables are set to ``C'' (see environ(5)).


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.

Call counts are always recorded precisely, however.

Only programs that call exit() (see exit(2)) or return from main cause a profile file to be produced, unless a final call to monitor() is explicitly coded.

The use of the cc -p option to invoke profiling imposes a limit of 600 functions that can have call counters established during program execution. For more counters, call monitor() directly. If this limit is exceeded, other data is overwritten and the mon.out file is corrupted. The number of call counters used is reported automatically by the prof command whenever the number exceeds 5/6 of the maximum.



for profile


for namelist


prof: SVID2, SVID3, XPG2

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.