gprof.1

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 1 代码 · 共 207 行

1
207
字号
.\" SCCSID: @(#)gprof.1	8.2	12/4/90.TH gprof 1 VAX "" Unsupported\"	@(#)gprof.1	1.9 (Berkeley) 10/12/82.SH Namegprof \- display call graph profile data.SH Syntax.B gprof[\|\fIoptions\fR\|] [\|\fIa.out\fR\|[\fIgmon.out...\fR\|]\|].SH Description.NXR "gprof command".NXA "cc compiler" "gprof command".NXA "pc compiler" "gprof command".NXA "f77 compiler" "gprof command".NXA "prof command" "gprof command".NXAM "monitor subroutine" "gprof command".NXAM "profil system call" "gprof command".NXR "C program" "displaying call graph profile data and".NXR "Pascal program" "displaying call graph profile data and".NXR "f77 program" "displaying call graph profile data and"The.PN gprofcommand produces an execution profile of C, Pascal,or Fortran77 programs.The effect of called routines is incorporated in the profile of each caller.The profile data is taken from the call graph profile file(gmon.outdefault) which is created by programswhich are compiled with the .B \-pgoption of .PN cc ,.PN pc ,and.PN f77.That option also links in versions of the library routines which are compiled for profiling.The symbol table in thenamed object file (a.out default)is read and correlated with thecall graph profile file.If more than one profile file is specified,the.PN gprofoutput shows the sum of the profile informationin the given profile files..PPFirst, a flat profile is given,similar to that provided by.MS prof 1 .This listing gives the total execution timesand call counts for each of the functionsin the program, sorted by decreasing time..PPNext, these times are propagated along the edges of the call graph.Cycles are discovered, and calls into a cycleare made to share the time of the cycle.A second listing shows the functionssorted according to the time they representincluding the time of their call graph descendents.Below each function entry is shown its (direct) call graph children,and how their times are propagated to this function.A similar display above the function shows how this function's time and thetime of its descendents is propagated toits (direct) call graph parents..PPCycles are also shown, with an entry for the cycle as a whole anda listing of the members of the cycle and their contributions to thetime and call counts of the cycle..SH Options.NXR "gprof command" "options"The following options are available:.IP \fB\-a\fR 20Suppresses the printing of statically declared functions.If this option is given, all relevant informationabout the static function(for example, time samples, calls to other functions, calls from other functions)belongs to the function loaded just before the static function in the.PN a.outfile..IP \fB\-b\fR 20Suppresses the printing of a description of each field in the profile..IP \fB\-c\fR 20The static call graph of the program is discovered by a heuristicwhich examines the text space of the object file.Static-only parents or children are indicatedwith call counts of 0..IP "\fB\-\|E\fI name\fR" 20Suppresses the printing of the graph profile entry for routine.I name(and its descendants) as .BR \-e ,above, and also excludes the time spent in.I name(and its descendants) from the total and percentage time computations.(For example,.B \-E.I mcount.B \-E.I mcleanupis the default.).IP "\fB\-\|e\fI name\fR" 20Suppresses the printing of the graph profile entry for routine.I nameand all its descendantsMore than one.B \-eoption may be given.Only one.I namemay be given with each.B \-eoption..IP "\fB\-\|F\fI name\fR" 20Prints the graph profile entry of only the routine.I nameand its descendants (as .BR \-f,above) and also uses only the times of the printed routinesin total time and percentage computations.More than one.B \-Foption may be given.Only one.I namemay be given with each.B \-Foption.The.B \-Foptionoverridesthe.B \-Eoption..IP "\fB\-\|f\fI name\fR" 20Prints the graph profile entry of only the specified routine.I nameand its descendants.More than one.B \-foption may be given.Only one.I namemay be given with each.B \-foption..IP \fB\-s\fR 20Produces a profile file.I gmon.sumis produced which representsthe sum of the profile information in all the specified profile files.This summary profile file may be given to subsequentexecutions of gprof (probably also with a.BR \-s )to accumulate profile data across several runs of an.I a.outfile..IP \fB\-z\fR 20Displays routines which have zero usage (as indicated by call countsand accumulated time).This is useful in conjunction with the .B \-coption for discovering which routines were never called..SH Restrictions.NXR "gprof command" "restricted"Beware of quantization errors.The granularity of the sampling is shown, but remainsstatistical at best.We assume that the time for each execution of a functioncan be expressed by the total time for the function dividedby the number of times the function is called.Thus the time propagated along the call graph arcs to parents of thatfunction is directly proportional to the number of times thatarc is traversed..PPParents which are not themselves profiled have the time of their profiled children propagated to them, but they appearto be spontaneously invoked in the call graph listing, and donot have their time propagated further.Similarly, signal catchers, even though profiled, appearto be spontaneous (although for more obscure reasons).Any profiled children of signal catchers should have their timespropagated properly, unless the signal catcher was invoked during the execution of the profiling routine, in which case all is lost..PPThe profiled program must call .MS exit 2or return normally for the profiling information to be savedin the .PN gmon.outfile..SH Files.TP 15.PN a.out	the name list and text space..TP 15.PN gmon.out	dynamic call graph and profile..TP 15.PN gmon.sum	summarized dynamic call graph and profile..SH See Alsocc(1), prof(1), profil(2), monitor(3)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?