*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: prof | Section: 1 | Source: Digital UNIX | File: prof.1.gz
prof(1) General Commands Manual prof(1) NAME prof, pixstats - Analyzes profile data SYNOPSIS prof [options] [prog_name [PC-sampling_data_file]... ] prof -pixie [options] [prog_name [Addrs_file|Counts_file]... ] prof -pixstats [options] [prog_name [Addrs_file|Counts_file]... ] pixstats [options] [prog_name [Addrs_file|Counts_file]... ] PARAMETERS Name of the program executable to be profiled. This program should be compiled with the -g1, -g2, or -g3 option to obtain more complete pro- filing information. If the default symbol table level (-g0) has been used, line number information, static procedure names, and file names are unavailable to the profiling code. Name of a profiling data file (default mon.out) produced by executing a program that has been linked with the cc -p command. Name of an instruction-counts file produced by executing a program that has been instrumented with pixie. If no Counts_file or Addrs_file is specified, prog_name.Counts is used if found in the current working directory. Name of an instruction-address file produced when the executable or shared library object is instru- mented with pixie. By default, the path of each object.Addrs file will be recorded in the Counts_file, so they do not need to be specified. The order of precedence for finding an Addrs_file is as follows: Ad- drs_file path specified on command line, current directory, directory of object specified in command line argument, directory where pixie created it. OPTIONS For each prof option, you need to type only enough of the name to dis- tinguish it from the other options. If you do not specify any options, prof uses -procedures by default. Always specify -pixie or -pixstats when you process .Addrs and .Counts files. The prof command accepts the following options: Causes the profiles for all shared libraries (if any) described in the data file(s) to be displayed, in addition to the profile for the exe- cutable. Causes the profiler to print the assembly instructions for each subroutine along with the cycle counts for each instruction. The subroutines are sorted from highest cycle count to lowest. The in- structions for each subroutine are printed in order; they are not sorted by cycle count. When used without the -pixie option for a PC-sampling profile, the CPU time used by each instruction is presented in milliseconds. (For upro- file and kprofile, per-instruction sample counts are provided for events other than time.) Alters the appropriate parts of the listing to reflect the clock speed of the CPU. By default, the cycle time of the processor on which program was run is used. (Use this option only with the -pixie option.) Disassembles and shows the analyzed object code. (Use this option only with the -pixstats option.) Limits the disassembly to blocks with f% frequency. (Use this option only with the -pixstats option.) If you use one or more -exclude options, the profiler omits the specified procedure and its descendents from the listing. If any option uses an uppercase "E" (for "Exclude"), prof also omits that procedure from the base upon which it calculates percent- ages. To represent all of the variations of an overloaded C++ function name, you can specify just the part of the name up to but not including the "(". Causes the profile for the named executable or shared library not to be printed. You can use this option multiple times in a single prof command. Produces a file with information that the compiler sys- tem can use to decide which parts of the program will benefit most from global optimization and which parts will benefit most from in-line pro- cedure substitution (requires basic-block counting). (Use this option only with the -pixie option.) Reports the most heavily used lines in descending order of use. Causes the profile for the named shared li- brary to be printed, in addition to the profile for the executable. You can use this option multiple times in a single prof command. For each procedure, reports how many times the procedure was invoked from each of its possible callers (requires basic-block counting). For this listing, the -exclude and -only options apply to callees, but not to callers. (Use this option only with the -pixie option.) Changes the library directory search order for shared object libraries so that prof looks for them in dir before the library recorded in profile_file and the default library directories. You can specify multiple -Ldir switches to specify several directory names. Changes the library di- rectory search order for shared object libraries so that prof never looks for them in the default library directories. Use this option when the default library directories should not be searched and only the directories specified by -Ldir are to be searched. Gives the lines in order of occurrence within procedures. The procedures are sorted in descending order of use. Sums the sampling data files (or, in pixie mode, the .Counts files) and writes the result into a new file with the specified name. The -only and -exclude options have no effect on the merged data. Uses 1 for each basic block count. (Use this option only with the -pixstats or -pixie option.) Prints each procedure's starting line number if source file information is available from the object file. If you use one or more -only options, the profile listing in- cludes only the named procedures, rather than the entire program. If any option uses an uppercase "O" for "Only," prof uses only the named procedures, rather than the entire program, as the base upon which it calculates percentages. To represent all of the variations of an over- loaded C++ function name, you can specify just the part of the name up to but not including the "(". Selects pixie mode, as opposed to sam- pling mode. Selects generation of an alternative pixie-mode report for basic-block profiling data, as previously produced by the pixstats(1) command. All options of the previous version of pixstats(1) are recog- nized, for compatibility. Reports time spent per procedure (using data obtained from sampling or basic-block counting; the listing tells which one). For basic-block counting, this option also reports the number of invocations per procedure, including the aggregated invocations of any alternate entry points. Truncates listings after n lines (if n is an integer), after the first entry that represents less than n percent of the total (if n is followed immediately by a "%" character), or after enough entries have been printed to account for n percent of the total (if n is followed immediately by "cum%"). For example, "-quit 15" truncates each part of the listing after 15 lines of text, "-quit 15%" truncates each part after the first line that represents less than 15 percent of the whole, and "-quit 15cum%" truncates each part after the line that brought the cumulative percentage above 15 percent. Reports all lines that never executed (requires basic-block counting). (Use this option only with the -pixie option.) For -procedures and -invoca- tions listings, prints cumulative statistics for the entire object file instead of for each procedure in the object. Generates more analysis of a program to provide a more accurate reading of cycles. The higher the number chosen from the arguments, the more accurate the reading, although the profiler will run slower. (Use this option only with the -pixie option.) Prints a list of procedures that were never invoked (requires basic-block counting). (Use this option only with the -pixie option.) DESCRIPTION The prof command analyzes one or more data files generated by the com- piler's execution-profiling system and produces a listing. The prof command can also combine those data files or produce a feedback file that lets the optimizer take into account the program's run-time behav- ior during a subsequent compilation. Profiling is a three-step process: Compile the program Execute the program Run prof to analyze the data. The compiler system provides two kinds of profiling: Interrupts the program periodically, recording the value of the program counter. Divides the program into blocks delimited by labels, jump in- structions, and branch instructions. It counts the number of times each block executes. This provides more detailed (line by line) information than PC-sampling. The uprofile and kprofile tools provide a third kind of profiling, per- formance counter sampling. The Alpha architecture on-chip performance counters are used in performance counter sampling. The following sections describe how to perform the various kinds of profiling. PC-Sampling Profiles To use PC-sampling, compile your program with the -p option (strictly speaking, it is sufficient to use this option only when linking the program). Then, run the program containing the profiling startup rou- tine that calls monstartup to allocate extra memory to hold the profil- ing data. If the program terminates normally or calls exit(2), it records the data in a file at the end of execution. If your program uses shared libraries, note that only its call-shared portion is profiled in detail. Only the total time spent in each shared library is recorded. To individually profile all library routines a program uses, build the program with the -non_shared switch (by de- fault, the compiler produces a call-shared object unless -non_shared is explicitly specified), or set the PROFFLAGS environment variable as de- scribed in the Environment Variables section. After running your program, use prof to analyze the PC-sampling data file. For example: cc -c myprog.c cc -p -o myprog myprog.o myprog (generates mon.out) prof myprog mon.out When you use prof for PC-sampling, the program name defaults to a.out. The PC-sampling data file name defaults to mon.out; if you specify more than one PC-sampling data file, prof reports the sum of the data. PC-Sampling Environment Variables You can use environment variables to change the default PC sampling and profile data collection behavior. The variables are PROFDIR and PROF- FLAGS. The general form for setting these variables is: For C shell: setenv varname "value" For Bourne shell: varname = "value"; export var- name For Korn shell: export varname = value In the preceding example, varname can be one of the following: This en- vironment variable causes PC-sampling data files to be generated with unique file names in a specified directory. You specify a directory path as the value and your prof results are placed in the file path/pid.progname where path is the pathname, pid is the process ID of the executing program, and progname is the program name. This environment variable can take any of the following values: Causes a separate data file to be generated for each thread. The name of the data file takes the following form: pid.sid.progname. The form of the filename resolves to pid as the process ID of the pro- gram, sid as the sequence number of the thread, and progname as the name of the program being profiled. Causes the program to fully pro- file all the permanently loaded shared libraries, in addition to the nonshared or call-shared executable. Causes the program to profile only the named executable or shared library. Causes the program not to profile the named executable or shared library. Causes prof to change the ratio of text segment stride size to PC-sample counter buffer size, that is, the number of instructions that are counted together in a sin- gle counter word. The appropriate ratio involves a tradeoff of size versus precision. Strides of 1, 2, 4, and 8 are supported. A special stride of 0 causes a single PC-sample count to be recorded for each text segment. The default stride is 2 for the executable, and 0 for each of its shared libraries. If -all or -incobj are specified, all selected ob- jects are profiled with the same stride. Automatically establishes monitor_signal(3) as the signal handler for the named signal, and it causes monitor_signal(3) to zero the profile after it is written to a file. This allows a signal to be sent several times without the succes- sive profiles overlapping, if the file is renamed. The asynchronous nature of a signal may cause small variations in the profile. Unrecog- nized signal-names are ignored. The -threads option is ignored if com- bined with -sigdump. Specifies the directory path in which the profil- ing data file or files are created. [Disables] or enables the addition of the process-id number to the name of the profiling data file or files. You can use the PROFDIR and PROFFLAGS environment variables together. For more information, see the Programmer's Guide. Basic-Block Counting To use basic-block counting, compile your program without the option -p. Use the pixie program to translate your program into a profiling version and generate a file (prog_name.Addrs) containing block ad- dresses. Then, run the pixie version of the program, which (assuming the program terminates normally or calls exit(2)) will generate a file (prog_name.Counts) containing block counts. After running the pixie version of your program, use prof with the -pixie option to analyze the .Addrsand .Counts files. Notice that you must specify the name of your original program, not the name of the .pixie version. For example: cc -c myprog.c cc -o myprog myprog.o pixie myprog (generates myprog.Addrs and myprog.pixie) myprog.pixie (generates myprog.Counts) prof -pixie myprog myprog.Addrs myprog.Counts When you use prof with the -pixie option, the .Addrs file name defaults to prog_name.Addrs, and the .Counts file name defaults to prog_name.Counts. Note that, when the .Counts file name defaults to prog_name.Counts, prof does not attach any path prefix to prog_name, and it looks for the .Counts file in the current working directory. If you specify more than one For each shared library selected for profiling, the prof command searches for an .Addrs file in the following locations if the file lo- cation is not explicitly specified on the command line: Current direc- tory Directory in which the object file is located if the location of the object file is explicitly specified on the command line Directory in which pixie created it, as recorded in the For each selected shared library, the prof command searches for an ob- ject file in the following locations: Directories specified in -Ldir options Directory in which pixie found it, as recorded in the Standard library search directories, as searched by ld, if the -L option is not specified Basic-Block Statistics Use the -pixstats option to get an alternative profile. All options of the previous version of the pixstats(1) command are recognized, for compatibility. If a disassembly is requested, all basic blocks (or those whose execu- tion count exceeds the -dislimit percentage of total instructions) are disassembled, in increasing address order. Each block is labeled with its procedure name and any offset from the start of the procedure. For each instruction, the relative estimated CPU cycle at which the in- struction executes is printed, plus its source line, address, binary code, and assembly language. The total CPU cycles used by one execu- tion of the block, the number of times it was executed, and its per- centage of all instructions executed are printed at the end of the block, following any line reporting a non-zero delay caused to a fol- low-on block. The main report begins with a record of the command line. This is fol- lowed by a summary of the program's behavior: Total CPU cycles used by the profiled objects, plus the equivalent number of seconds Total num- ber of instructions executed Total delay caused by instructions exe- cuted in the preceding basic block Total integer and floating-point no- op, arithmetic and logical, logical, shift, load, store, load and store, load followed by load, load and store and fetch (data bus use), load and store relative to the stack or global pointers, floating- point, floating-point compare, conditional branch instructions executed (itemized). Also, total number of branch instructions executed whose target instruction is another branch; and total number of such branches that are estimated to be taken, rather than executing the next instruc- tion in line. Total basic blocks, procedure calls, and branches that skip a single instruction that were executed. Next, some ratios are printed: Stores : stores + loads Instructions : basic block Instructions : branches Backward branches : branches CPU cycles : procedure calls Instructions : procedure calls Integer no-ops : integer and floating-point no-ops Floating-point no-ops : integer and floating-point no-ops Floating-point pipeline interlocks : floating- point operators Next, basic blocks are analyzed according to how many instructions they contain. For each size, pixstats reports the execution count, its pre- centage and cumulative percentage relative to both instructions and ba- sic blocks, the number of instructions contained in blocks of that size, the percentage and cumulative percentage of this relative to all instructions, and the CPU-cycle cost per instruction of blocks of that size. Then, pixstats prints various averages and quartiles of basic block size, plus the largest basic block execution count encountered (to indicate the chance of integer overflow in the analysis). Next, pixstats analyzes the number of registers (integer and floating- point) that are saved on procedure entry (and restored on exit). It prints the number of procedure entries that save a given number of reg- isters, and the percentage and cumulative percentage of this relative to all procedure entries, all registers saved, and all instructions ex- ecuted. Finally, it prints some averages and ratios. The next two tables contain information on the sizes of executed proce- dures' stack frames and the frequency of execution of each kind of in- struction. Frame sizes are reported in "bits"; for example, 6 bits means a 32- to 48-byte stack frame. The number, percentage, and cumula- tive percentage of executed calls to procedures with the given frame size is printed. Similarly, the execution count is printed for each ma- chine instruction code, but this table is ordered by decreasing usage. The next four tables are similar. They provide information about the size of literals used by various categories of Alpha instructions: ADD,SUB,CMP instructions AND,BIC,BIS,XOR,CMOV instructions MUL instruc- tions SHIFT,EXT,INS,MSK,ZAP instructions (Note that a table may be omitted if there is no use of literals in the program for the particular instruction category). For each of these ta- bles the size of the literal is reported in bits (for example, 4 bits means the literal is greater than or equal to 8 and less than 16). The next six tables are similar. They contain information on the size of the memory displacement from a base register: LDA displacement from 0 (used like a load immediate instruction) LDAH displacement from 0 (used like a load immediate high) Branch SP-based load/store (load or store within a stack frame) GP-based load/store (load or store within a global offset table) All load or store instructions Again, the "size" of the displacement is reported in bits; for example, 6 bits means a 32 to 63 byte displacement. For both positive displace- ments (in the "0-extend" column) and negative displacements (in the "1-extend" column), the execution count is printed along with percent- age and cumulative percentage. The summed cumulative percentage is printed last (in the "Total" column). In the "static" analysis of instructions, each instruction is counted once per executed basic-block. The "static" distribution will be the same as the regular opcode distribution when -nocounts is specified. Following "static" totals for instructions and basic blocks, the number and percentage of each instruction code is listed. The next two tables contain information on how many times each integer and floating-point register was accessed, plus its percentage, ordered by register number. For integer registers, the number and percent of uses as a base register in memory operations is also listed. Finally, pixstats prints a flat profile of CPU cycles used by proce- dures. This includes the CPU cycles used by the procedure, the per- centage of the total, the cumulative percentage, the number of instruc- tions executed as part of the procedure, its average number of CPU cy- cles per instruction, the number of calls made to the procedure, the average number of CPU cycles per call, and the procedure name. If -num- bers is specified, the object and source file names and line number are also printed. Performance Counter Samples After running the uprofile or kprofile utility to collect profiling data or your program or the kernel, respectively, run prof to examine the resulting mon.out or kmon.out file, as follows: For uprofile out- put: prof prog_name mon.out For kprofile output: prof /vmunix kmon.out Use prof as for PC sampling, except that only the executable has a pro- file. Old performance counter sample data files, generated on versions of the operating system prior to Digital UNIX Version 4.0, must be ana- lyzed as if they contained PC-sampling data. RESTRICTIONS The -pixstats option models execution assuming a perfect memory system. Memory system events such as cache misses will increase execution above the -pixstats predictions. The set of statistics reported by the -pixstats option and the format of the report are the same as for previous versions of the pixstats(1) command, but note the following: The labels on disassembled basic blocks take the form procedure-name (or proc_at_0x... if no symbol is available) for an initial block and procedure-name+offset for subse- quent blocks. All reported cycles reflect CPU pipeline interlocks, so they usually do not match the reported instruction counts. If not all the shared objects used by a program are profiled, the procedure-call counts may be smaller than the jsr/bsr instruction counts. FILES Normal startup code Startup code for PC-sampling Library for PC-sam- pling Default kprofile data file Default PC-sampling data file Default uprofile data file SEE ALSO Programmer's Guide Commands: as(1), atom(1), cc(1), gprof(1), dxprof(1). (dxprof(1) is available only if the Developer's Tool Kit and associated reference pages are installed on your system.) Atom Tools: pixie(5) Functions: monitor(3), profil(2) delim off prof(1)

Navigation Options