Changeset 609 for branches/GNU/src/binutils/gprof/gprof.texi
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/gprof/gprof.texi
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 19 19 This file documents the gprof profiler of the GNU system. 20 20 21 Copyright (C) 1988, 92, 97, 98, 99, 2000 Free Software Foundation, Inc. 21 @c man begin COPYRIGHT 22 Copyright (C) 1988, 92, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. 23 24 Permission is granted to copy, distribute and/or modify this document 25 under the terms of the GNU Free Documentation License, Version 1.1 26 or any later version published by the Free Software Foundation; 27 with no Invariant Sections, with no Front-Cover Texts, and with no 28 Back-Cover Texts. A copy of the license is included in the 29 section entitled "GNU Free Documentation License". 30 31 @c man end 32 33 @ignore 34 Permission is granted to process this file through Tex and print the 35 results, provided the printed document carries copying permission 36 notice identical to this one except for the removal of this paragraph 37 (this paragraph not being relevant to the printed manual). 38 39 @end ignore 40 @end ifinfo 41 42 @finalout 43 @smallbook 44 45 @titlepage 46 @title GNU gprof 47 @subtitle The @sc{gnu} Profiler 48 @author Jay Fenlason and Richard Stallman 49 50 @page 51 52 This manual describes the @sc{gnu} profiler, @code{gprof}, and how you 53 can use it to determine which parts of a program are taking most of the 54 execution time. We assume that you know how to write, compile, and 55 execute programs. @sc{gnu} @code{gprof} was written by Jay Fenlason. 56 57 @vskip 0pt plus 1filll 58 Copyright @copyright{} 1988, 92, 97, 98, 99, 2000 Free Software Foundation, Inc. 22 59 23 60 Permission is granted to copy, distribute and/or modify this document … … 28 65 section entitled "GNU Free Documentation License". 29 66 30 @ignore31 Permission is granted to process this file through Tex and print the32 results, provided the printed document carries copying permission33 notice identical to this one except for the removal of this paragraph34 (this paragraph not being relevant to the printed manual).35 36 @end ignore37 @end ifinfo38 39 @finalout40 @smallbook41 42 @titlepage43 @title GNU gprof44 @subtitle The @sc{gnu} Profiler45 @author Jay Fenlason and Richard Stallman46 47 @page48 49 This manual describes the @sc{gnu} profiler, @code{gprof}, and how you50 can use it to determine which parts of a program are taking most of the51 execution time. We assume that you know how to write, compile, and52 execute programs. @sc{gnu} @code{gprof} was written by Jay Fenlason.53 54 @vskip 0pt plus 1filll55 Copyright @copyright{} 1988, 92, 97, 98, 99, 2000 Free Software Foundation, Inc.56 57 Permission is granted to copy, distribute and/or modify this document58 under the terms of the GNU Free Documentation License, Version 1.159 or any later version published by the Free Software Foundation;60 with no Invariant Sections, with no Front-Cover Texts, and with no61 Back-Cover Texts. A copy of the license is included in the62 section entitled "GNU Free Documentation License".63 64 67 @end titlepage 65 68 66 @if info69 @ifnottex 67 70 @node Top 68 71 @top Profiling a Program: Where Does It Spend Its Time? … … 92 95 * GNU Free Documentation License:: GNU Free Documentation License 93 96 @end menu 94 @end if info97 @end ifnottex 95 98 96 99 @node Introduction 97 100 @chapter Introduction to Profiling 101 102 @ifset man 103 @c man title gprof display call graph profile data 104 105 @smallexample 106 @c man begin SYNOPSIS 107 gprof [ -[abcDhilLsTvwxyz] ] [ -[ACeEfFJnNOpPqQZ][@var{name}] ] 108 [ -I @var{dirs} ] [ -d[@var{num}] ] [ -k @var{from/to} ] 109 [ -m @var{min-count} ] [ -t @var{table-length} ] 110 [ --[no-]annotated-source[=@var{name}] ] 111 [ --[no-]exec-counts[=@var{name}] ] 112 [ --[no-]flat-profile[=@var{name}] ] [ --[no-]graph[=@var{name}] ] 113 [ --[no-]time=@var{name}] [ --all-lines ] [ --brief ] 114 [ --debug[=@var{level}] ] [ --function-ordering ] 115 [ --file-ordering ] [ --directory-path=@var{dirs} ] 116 [ --display-unused-functions ] [ --file-format=@var{name} ] 117 [ --file-info ] [ --help ] [ --line ] [ --min-count=@var{n} ] 118 [ --no-static ] [ --print-path ] [ --separate-files ] 119 [ --static-call-graph ] [ --sum ] [ --table-length=@var{len} ] 120 [ --traditional ] [ --version ] [ --width=@var{n} ] 121 [ --ignore-non-functions ] [ --demangle[=@var{STYLE}] ] 122 [ --no-demangle ] [ @var{image-file} ] [ @var{profile-file} @dots{} ] 123 @c man end 124 @end smallexample 125 126 @c man begin DESCRIPTION 127 @code{gprof} produces an execution profile of C, Pascal, or Fortran77 128 programs. The effect of called routines is incorporated in the profile 129 of each caller. The profile data is taken from the call graph profile file 130 (@file{gmon.out} default) which is created by programs 131 that are compiled with the @samp{-pg} option of 132 @code{cc}, @code{pc}, and @code{f77}. 133 The @samp{-pg} option also links in versions of the library routines 134 that are compiled for profiling. @code{Gprof} reads the given object 135 file (the default is @code{a.out}) and establishes the relation between 136 its symbol table and the call graph profile from @file{gmon.out}. 137 If more than one profile file is specified, the @code{gprof} 138 output shows the sum of the profile information in the given profile files. 139 140 @code{Gprof} calculates the amount of time spent in each routine. 141 Next, these times are propagated along the edges of the call graph. 142 Cycles are discovered, and calls into a cycle are made to share the time 143 of the cycle. 144 145 @c man end 146 147 @c man begin BUGS 148 The granularity of the sampling is shown, but remains 149 statistical at best. 150 We assume that the time for each execution of a function 151 can be expressed by the total time for the function divided 152 by the number of times the function is called. 153 Thus the time propagated along the call graph arcs to the function's 154 parents is directly proportional to the number of times that 155 arc is traversed. 156 157 Parents that are not themselves profiled will have the time of 158 their profiled children propagated to them, but they will appear 159 to be spontaneously invoked in the call graph listing, and will 160 not have their time propagated further. 161 Similarly, signal catchers, even though profiled, will appear 162 to be spontaneous (although for more obscure reasons). 163 Any profiled children of signal catchers should have their times 164 propagated properly, unless the signal catcher was invoked during 165 the execution of the profiling routine, in which case all is lost. 166 167 The profiled program must call @code{exit}(2) 168 or return normally for the profiling information to be saved 169 in the @file{gmon.out} file. 170 @c man end 171 172 @c man begin FILES 173 @table @code 174 @item @file{a.out} 175 the namelist and text space. 176 @item @file{gmon.out} 177 dynamic call graph and profile. 178 @item @file{gmon.sum} 179 summarized dynamic call graph and profile. 180 @end table 181 @c man end 182 183 @c man begin SEEALSO 184 monitor(3), profil(2), cc(1), prof(1), and the Info entry for @file{gprof}. 185 186 ``An Execution Profiler for Modular Programs'', 187 by S. Graham, P. Kessler, M. McKusick; 188 Software - Practice and Experience, 189 Vol. 13, pp. 671-685, 1983. 190 191 ``gprof: A Call Graph Execution Profiler'', 192 by S. Graham, P. Kessler, M. McKusick; 193 Proceedings of the SIGPLAN '82 Symposium on Compiler Construction, 194 SIGPLAN Notices, Vol. 17, No 6, pp. 120-126, June 1982. 195 @c man end 196 @end ifset 98 197 99 198 Profiling allows you to learn where your program spent its time and which … … 130 229 The next three chapters explain these steps in greater detail. 131 230 231 @c man begin DESCRIPTION 232 132 233 Several forms of output are available from the analysis. 133 234 … … 146 247 source code, labeled with the number of times each line of the 147 248 program was executed. @xref{Annotated Source}. 249 @c man end 148 250 149 251 To better understand how profiling works, you may wish to read … … 256 358 The Perl script @code{bbconv.pl}, included with the @code{gprof} 257 359 source distribution, will convert a @file{bb.out} file into 258 a format readable by @code{gprof}. 360 a format readable by @code{gprof}. Invoke it like this: 361 362 @smallexample 363 bbconv.pl < bb.out > @var{bh-data} 364 @end smallexample 365 366 This translates the information in @file{bb.out} into a form that 367 @code{gprof} can understand. But you still need to tell @code{gprof} 368 about the existence of this translated information. To do that, include 369 @var{bb-data} on the @code{gprof} command line, @emph{along with 370 @file{gmon.out}}, like this: 371 372 @smallexample 373 gprof @var{options} @var{executable-file} gmon.out @var{bb-data} [@var{yet-more-profile-data-files}@dots{}] [> @var{outfile}] 374 @end smallexample 259 375 260 376 @node Invoking … … 298 414 @section Output Options 299 415 416 @c man begin OPTIONS 300 417 These options specify which of several output formats 301 418 @code{gprof} should produce. … … 635 752 636 753 @end table 754 755 @c man end 637 756 638 757 Note that only one function can be specified with each @code{-e}, … … 1732 1851 consists of a header containing the magic cookie and a version number, 1733 1852 as well as some spare bytes available for future extensions. All data 1734 in a profile data file is in the native format of the host onwhich1735 the profile was collected. @sc{gnu} @code{gprof} adapts automatically to the1736 byte-order in use.1853 in a profile data file is in the native format of the target for which 1854 the profile was collected. @sc{gnu} @code{gprof} adapts automatically 1855 to the byte-order in use. 1737 1856 1738 1857 In the new file format, the header is followed by a sequence of -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.