Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

2460 lines
110KB

  1. This is gprof.info, produced by makeinfo version 6.5 from gprof.texi.
  2. This file documents the gprof profiler of the GNU system.
  3. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with no
  7. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  8. Texts. A copy of the license is included in the section entitled "GNU
  9. Free Documentation License".
  10. INFO-DIR-SECTION Software development
  11. START-INFO-DIR-ENTRY
  12. * gprof: (gprof). Profiling your program's execution
  13. END-INFO-DIR-ENTRY
  14. 
  15. File: gprof.info, Node: Top, Next: Introduction, Up: (dir)
  16. Profiling a Program: Where Does It Spend Its Time?
  17. **************************************************
  18. This manual describes the GNU profiler, 'gprof', and how you can use it
  19. to determine which parts of a program are taking most of the execution
  20. time. We assume that you know how to write, compile, and execute
  21. programs. GNU 'gprof' was written by Jay Fenlason.
  22. This manual is for 'gprof' (GNU Arm Embedded Toolchain
  23. 10-2020-q4-major) version 2.35.1.
  24. This document is distributed under the terms of the GNU Free
  25. Documentation License version 1.3. A copy of the license is included in
  26. the section entitled "GNU Free Documentation License".
  27. * Menu:
  28. * Introduction:: What profiling means, and why it is useful.
  29. * Compiling:: How to compile your program for profiling.
  30. * Executing:: Executing your program to generate profile data
  31. * Invoking:: How to run 'gprof', and its options
  32. * Output:: Interpreting 'gprof''s output
  33. * Inaccuracy:: Potential problems you should be aware of
  34. * How do I?:: Answers to common questions
  35. * Incompatibilities:: (between GNU 'gprof' and Unix 'gprof'.)
  36. * Details:: Details of how profiling is done
  37. * GNU Free Documentation License:: GNU Free Documentation License
  38. 
  39. File: gprof.info, Node: Introduction, Next: Compiling, Prev: Top, Up: Top
  40. 1 Introduction to Profiling
  41. ***************************
  42. Profiling allows you to learn where your program spent its time and
  43. which functions called which other functions while it was executing.
  44. This information can show you which pieces of your program are slower
  45. than you expected, and might be candidates for rewriting to make your
  46. program execute faster. It can also tell you which functions are being
  47. called more or less often than you expected. This may help you spot
  48. bugs that had otherwise been unnoticed.
  49. Since the profiler uses information collected during the actual
  50. execution of your program, it can be used on programs that are too large
  51. or too complex to analyze by reading the source. However, how your
  52. program is run will affect the information that shows up in the profile
  53. data. If you don't use some feature of your program while it is being
  54. profiled, no profile information will be generated for that feature.
  55. Profiling has several steps:
  56. * You must compile and link your program with profiling enabled.
  57. *Note Compiling a Program for Profiling: Compiling.
  58. * You must execute your program to generate a profile data file.
  59. *Note Executing the Program: Executing.
  60. * You must run 'gprof' to analyze the profile data. *Note 'gprof'
  61. Command Summary: Invoking.
  62. The next three chapters explain these steps in greater detail.
  63. Several forms of output are available from the analysis.
  64. The "flat profile" shows how much time your program spent in each
  65. function, and how many times that function was called. If you simply
  66. want to know which functions burn most of the cycles, it is stated
  67. concisely here. *Note The Flat Profile: Flat Profile.
  68. The "call graph" shows, for each function, which functions called it,
  69. which other functions it called, and how many times. There is also an
  70. estimate of how much time was spent in the subroutines of each function.
  71. This can suggest places where you might try to eliminate function calls
  72. that use a lot of time. *Note The Call Graph: Call Graph.
  73. The "annotated source" listing is a copy of the program's source
  74. code, labeled with the number of times each line of the program was
  75. executed. *Note The Annotated Source Listing: Annotated Source.
  76. To better understand how profiling works, you may wish to read a
  77. description of its implementation. *Note Implementation of Profiling:
  78. Implementation.
  79. 
  80. File: gprof.info, Node: Compiling, Next: Executing, Prev: Introduction, Up: Top
  81. 2 Compiling a Program for Profiling
  82. ***********************************
  83. The first step in generating profile information for your program is to
  84. compile and link it with profiling enabled.
  85. To compile a source file for profiling, specify the '-pg' option when
  86. you run the compiler. (This is in addition to the options you normally
  87. use.)
  88. To link the program for profiling, if you use a compiler such as 'cc'
  89. to do the linking, simply specify '-pg' in addition to your usual
  90. options. The same option, '-pg', alters either compilation or linking
  91. to do what is necessary for profiling. Here are examples:
  92. cc -g -c myprog.c utils.c -pg
  93. cc -o myprog myprog.o utils.o -pg
  94. The '-pg' option also works with a command that both compiles and
  95. links:
  96. cc -o myprog myprog.c utils.c -g -pg
  97. Note: The '-pg' option must be part of your compilation options as
  98. well as your link options. If it is not then no call-graph data will be
  99. gathered and when you run 'gprof' you will get an error message like
  100. this:
  101. gprof: gmon.out file is missing call-graph data
  102. If you add the '-Q' switch to suppress the printing of the call graph
  103. data you will still be able to see the time samples:
  104. Flat profile:
  105. Each sample counts as 0.01 seconds.
  106. % cumulative self self total
  107. time seconds seconds calls Ts/call Ts/call name
  108. 44.12 0.07 0.07 zazLoop
  109. 35.29 0.14 0.06 main
  110. 20.59 0.17 0.04 bazMillion
  111. If you run the linker 'ld' directly instead of through a compiler
  112. such as 'cc', you may have to specify a profiling startup file 'gcrt0.o'
  113. as the first input file instead of the usual startup file 'crt0.o'. In
  114. addition, you would probably want to specify the profiling C library,
  115. 'libc_p.a', by writing '-lc_p' instead of the usual '-lc'. This is not
  116. absolutely necessary, but doing this gives you number-of-calls
  117. information for standard library functions such as 'read' and 'open'.
  118. For example:
  119. ld -o myprog /lib/gcrt0.o myprog.o utils.o -lc_p
  120. If you are running the program on a system which supports shared
  121. libraries you may run into problems with the profiling support code in a
  122. shared library being called before that library has been fully
  123. initialised. This is usually detected by the program encountering a
  124. segmentation fault as soon as it is run. The solution is to link
  125. against a static version of the library containing the profiling support
  126. code, which for 'gcc' users can be done via the '-static' or
  127. '-static-libgcc' command-line option. For example:
  128. gcc -g -pg -static-libgcc myprog.c utils.c -o myprog
  129. If you compile only some of the modules of the program with '-pg',
  130. you can still profile the program, but you won't get complete
  131. information about the modules that were compiled without '-pg'. The
  132. only information you get for the functions in those modules is the total
  133. time spent in them; there is no record of how many times they were
  134. called, or from where. This will not affect the flat profile (except
  135. that the 'calls' field for the functions will be blank), but will
  136. greatly reduce the usefulness of the call graph.
  137. If you wish to perform line-by-line profiling you should use the
  138. 'gcov' tool instead of 'gprof'. See that tool's manual or info pages
  139. for more details of how to do this.
  140. Note, older versions of 'gcc' produce line-by-line profiling
  141. information that works with 'gprof' rather than 'gcov' so there is still
  142. support for displaying this kind of information in 'gprof'. *Note
  143. Line-by-line Profiling: Line-by-line.
  144. It also worth noting that 'gcc' implements a '-finstrument-functions'
  145. command-line option which will insert calls to special user supplied
  146. instrumentation routines at the entry and exit of every function in
  147. their program. This can be used to implement an alternative profiling
  148. scheme.
  149. 
  150. File: gprof.info, Node: Executing, Next: Invoking, Prev: Compiling, Up: Top
  151. 3 Executing the Program
  152. ***********************
  153. Once the program is compiled for profiling, you must run it in order to
  154. generate the information that 'gprof' needs. Simply run the program as
  155. usual, using the normal arguments, file names, etc. The program should
  156. run normally, producing the same output as usual. It will, however, run
  157. somewhat slower than normal because of the time spent collecting and
  158. writing the profile data.
  159. The way you run the program--the arguments and input that you give
  160. it--may have a dramatic effect on what the profile information shows.
  161. The profile data will describe the parts of the program that were
  162. activated for the particular input you use. For example, if the first
  163. command you give to your program is to quit, the profile data will show
  164. the time used in initialization and in cleanup, but not much else.
  165. Your program will write the profile data into a file called
  166. 'gmon.out' just before exiting. If there is already a file called
  167. 'gmon.out', its contents are overwritten. There is currently no way to
  168. tell the program to write the profile data under a different name, but
  169. you can rename the file afterwards if you are concerned that it may be
  170. overwritten.
  171. In order to write the 'gmon.out' file properly, your program must
  172. exit normally: by returning from 'main' or by calling 'exit'. Calling
  173. the low-level function '_exit' does not write the profile data, and
  174. neither does abnormal termination due to an unhandled signal.
  175. The 'gmon.out' file is written in the program's _current working
  176. directory_ at the time it exits. This means that if your program calls
  177. 'chdir', the 'gmon.out' file will be left in the last directory your
  178. program 'chdir''d to. If you don't have permission to write in this
  179. directory, the file is not written, and you will get an error message.
  180. Older versions of the GNU profiling library may also write a file
  181. called 'bb.out'. This file, if present, contains an human-readable
  182. listing of the basic-block execution counts. Unfortunately, the
  183. appearance of a human-readable 'bb.out' means the basic-block counts
  184. didn't get written into 'gmon.out'. The Perl script 'bbconv.pl',
  185. included with the 'gprof' source distribution, will convert a 'bb.out'
  186. file into a format readable by 'gprof'. Invoke it like this:
  187. bbconv.pl < bb.out > BH-DATA
  188. This translates the information in 'bb.out' into a form that 'gprof'
  189. can understand. But you still need to tell 'gprof' about the existence
  190. of this translated information. To do that, include BB-DATA on the
  191. 'gprof' command line, _along with 'gmon.out'_, like this:
  192. gprof OPTIONS EXECUTABLE-FILE gmon.out BB-DATA [YET-MORE-PROFILE-DATA-FILES...] [> OUTFILE]
  193. 
  194. File: gprof.info, Node: Invoking, Next: Output, Prev: Executing, Up: Top
  195. 4 'gprof' Command Summary
  196. *************************
  197. After you have a profile data file 'gmon.out', you can run 'gprof' to
  198. interpret the information in it. The 'gprof' program prints a flat
  199. profile and a call graph on standard output. Typically you would
  200. redirect the output of 'gprof' into a file with '>'.
  201. You run 'gprof' like this:
  202. gprof OPTIONS [EXECUTABLE-FILE [PROFILE-DATA-FILES...]] [> OUTFILE]
  203. Here square-brackets indicate optional arguments.
  204. If you omit the executable file name, the file 'a.out' is used. If
  205. you give no profile data file name, the file 'gmon.out' is used. If any
  206. file is not in the proper format, or if the profile data file does not
  207. appear to belong to the executable file, an error message is printed.
  208. You can give more than one profile data file by entering all their
  209. names after the executable file name; then the statistics in all the
  210. data files are summed together.
  211. The order of these options does not matter.
  212. * Menu:
  213. * Output Options:: Controlling 'gprof''s output style
  214. * Analysis Options:: Controlling how 'gprof' analyzes its data
  215. * Miscellaneous Options::
  216. * Deprecated Options:: Options you no longer need to use, but which
  217. have been retained for compatibility
  218. * Symspecs:: Specifying functions to include or exclude
  219. 
  220. File: gprof.info, Node: Output Options, Next: Analysis Options, Up: Invoking
  221. 4.1 Output Options
  222. ==================
  223. These options specify which of several output formats 'gprof' should
  224. produce.
  225. Many of these options take an optional "symspec" to specify functions
  226. to be included or excluded. These options can be specified multiple
  227. times, with different symspecs, to include or exclude sets of symbols.
  228. *Note Symspecs: Symspecs.
  229. Specifying any of these options overrides the default ('-p -q'),
  230. which prints a flat profile and call graph analysis for all functions.
  231. '-A[SYMSPEC]'
  232. '--annotated-source[=SYMSPEC]'
  233. The '-A' option causes 'gprof' to print annotated source code. If
  234. SYMSPEC is specified, print output only for matching symbols.
  235. *Note The Annotated Source Listing: Annotated Source.
  236. '-b'
  237. '--brief'
  238. If the '-b' option is given, 'gprof' doesn't print the verbose
  239. blurbs that try to explain the meaning of all of the fields in the
  240. tables. This is useful if you intend to print out the output, or
  241. are tired of seeing the blurbs.
  242. '-C[SYMSPEC]'
  243. '--exec-counts[=SYMSPEC]'
  244. The '-C' option causes 'gprof' to print a tally of functions and
  245. the number of times each was called. If SYMSPEC is specified,
  246. print tally only for matching symbols.
  247. If the profile data file contains basic-block count records,
  248. specifying the '-l' option, along with '-C', will cause basic-block
  249. execution counts to be tallied and displayed.
  250. '-i'
  251. '--file-info'
  252. The '-i' option causes 'gprof' to display summary information about
  253. the profile data file(s) and then exit. The number of histogram,
  254. call graph, and basic-block count records is displayed.
  255. '-I DIRS'
  256. '--directory-path=DIRS'
  257. The '-I' option specifies a list of search directories in which to
  258. find source files. Environment variable GPROF_PATH can also be
  259. used to convey this information. Used mostly for annotated source
  260. output.
  261. '-J[SYMSPEC]'
  262. '--no-annotated-source[=SYMSPEC]'
  263. The '-J' option causes 'gprof' not to print annotated source code.
  264. If SYMSPEC is specified, 'gprof' prints annotated source, but
  265. excludes matching symbols.
  266. '-L'
  267. '--print-path'
  268. Normally, source filenames are printed with the path component
  269. suppressed. The '-L' option causes 'gprof' to print the full
  270. pathname of source filenames, which is determined from symbolic
  271. debugging information in the image file and is relative to the
  272. directory in which the compiler was invoked.
  273. '-p[SYMSPEC]'
  274. '--flat-profile[=SYMSPEC]'
  275. The '-p' option causes 'gprof' to print a flat profile. If SYMSPEC
  276. is specified, print flat profile only for matching symbols. *Note
  277. The Flat Profile: Flat Profile.
  278. '-P[SYMSPEC]'
  279. '--no-flat-profile[=SYMSPEC]'
  280. The '-P' option causes 'gprof' to suppress printing a flat profile.
  281. If SYMSPEC is specified, 'gprof' prints a flat profile, but
  282. excludes matching symbols.
  283. '-q[SYMSPEC]'
  284. '--graph[=SYMSPEC]'
  285. The '-q' option causes 'gprof' to print the call graph analysis.
  286. If SYMSPEC is specified, print call graph only for matching symbols
  287. and their children. *Note The Call Graph: Call Graph.
  288. '-Q[SYMSPEC]'
  289. '--no-graph[=SYMSPEC]'
  290. The '-Q' option causes 'gprof' to suppress printing the call graph.
  291. If SYMSPEC is specified, 'gprof' prints a call graph, but excludes
  292. matching symbols.
  293. '-t'
  294. '--table-length=NUM'
  295. The '-t' option causes the NUM most active source lines in each
  296. source file to be listed when source annotation is enabled. The
  297. default is 10.
  298. '-y'
  299. '--separate-files'
  300. This option affects annotated source output only. Normally,
  301. 'gprof' prints annotated source files to standard-output. If this
  302. option is specified, annotated source for a file named
  303. 'path/FILENAME' is generated in the file 'FILENAME-ann'. If the
  304. underlying file system would truncate 'FILENAME-ann' so that it
  305. overwrites the original 'FILENAME', 'gprof' generates annotated
  306. source in the file 'FILENAME.ann' instead (if the original file
  307. name has an extension, that extension is _replaced_ with '.ann').
  308. '-Z[SYMSPEC]'
  309. '--no-exec-counts[=SYMSPEC]'
  310. The '-Z' option causes 'gprof' not to print a tally of functions
  311. and the number of times each was called. If SYMSPEC is specified,
  312. print tally, but exclude matching symbols.
  313. '-r'
  314. '--function-ordering'
  315. The '--function-ordering' option causes 'gprof' to print a
  316. suggested function ordering for the program based on profiling
  317. data. This option suggests an ordering which may improve paging,
  318. tlb and cache behavior for the program on systems which support
  319. arbitrary ordering of functions in an executable.
  320. The exact details of how to force the linker to place functions in
  321. a particular order is system dependent and out of the scope of this
  322. manual.
  323. '-R MAP_FILE'
  324. '--file-ordering MAP_FILE'
  325. The '--file-ordering' option causes 'gprof' to print a suggested .o
  326. link line ordering for the program based on profiling data. This
  327. option suggests an ordering which may improve paging, tlb and cache
  328. behavior for the program on systems which do not support arbitrary
  329. ordering of functions in an executable.
  330. Use of the '-a' argument is highly recommended with this option.
  331. The MAP_FILE argument is a pathname to a file which provides
  332. function name to object file mappings. The format of the file is
  333. similar to the output of the program 'nm'.
  334. c-parse.o:00000000 T yyparse
  335. c-parse.o:00000004 C yyerrflag
  336. c-lang.o:00000000 T maybe_objc_method_name
  337. c-lang.o:00000000 T print_lang_statistics
  338. c-lang.o:00000000 T recognize_objc_keyword
  339. c-decl.o:00000000 T print_lang_identifier
  340. c-decl.o:00000000 T print_lang_type
  341. ...
  342. To create a MAP_FILE with GNU 'nm', type a command like 'nm
  343. --extern-only --defined-only -v --print-file-name program-name'.
  344. '-T'
  345. '--traditional'
  346. The '-T' option causes 'gprof' to print its output in "traditional"
  347. BSD style.
  348. '-w WIDTH'
  349. '--width=WIDTH'
  350. Sets width of output lines to WIDTH. Currently only used when
  351. printing the function index at the bottom of the call graph.
  352. '-x'
  353. '--all-lines'
  354. This option affects annotated source output only. By default, only
  355. the lines at the beginning of a basic-block are annotated. If this
  356. option is specified, every line in a basic-block is annotated by
  357. repeating the annotation for the first line. This behavior is
  358. similar to 'tcov''s '-a'.
  359. '--demangle[=STYLE]'
  360. '--no-demangle'
  361. These options control whether C++ symbol names should be demangled
  362. when printing output. The default is to demangle symbols. The
  363. '--no-demangle' option may be used to turn off demangling.
  364. Different compilers have different mangling styles. The optional
  365. demangling style argument can be used to choose an appropriate
  366. demangling style for your compiler.
  367. 
  368. File: gprof.info, Node: Analysis Options, Next: Miscellaneous Options, Prev: Output Options, Up: Invoking
  369. 4.2 Analysis Options
  370. ====================
  371. '-a'
  372. '--no-static'
  373. The '-a' option causes 'gprof' to suppress the printing of
  374. statically declared (private) functions. (These are functions
  375. whose names are not listed as global, and which are not visible
  376. outside the file/function/block where they were defined.) Time
  377. spent in these functions, calls to/from them, etc., will all be
  378. attributed to the function that was loaded directly before it in
  379. the executable file. This option affects both the flat profile and
  380. the call graph.
  381. '-c'
  382. '--static-call-graph'
  383. The '-c' option causes the call graph of the program to be
  384. augmented by a heuristic which examines the text space of the
  385. object file and identifies function calls in the binary machine
  386. code. Since normal call graph records are only generated when
  387. functions are entered, this option identifies children that could
  388. have been called, but never were. Calls to functions that were not
  389. compiled with profiling enabled are also identified, but only if
  390. symbol table entries are present for them. Calls to dynamic
  391. library routines are typically _not_ found by this option. Parents
  392. or children identified via this heuristic are indicated in the call
  393. graph with call counts of '0'.
  394. '-D'
  395. '--ignore-non-functions'
  396. The '-D' option causes 'gprof' to ignore symbols which are not
  397. known to be functions. This option will give more accurate profile
  398. data on systems where it is supported (Solaris and HPUX for
  399. example).
  400. '-k FROM/TO'
  401. The '-k' option allows you to delete from the call graph any arcs
  402. from symbols matching symspec FROM to those matching symspec TO.
  403. '-l'
  404. '--line'
  405. The '-l' option enables line-by-line profiling, which causes
  406. histogram hits to be charged to individual source code lines,
  407. instead of functions. This feature only works with programs
  408. compiled by older versions of the 'gcc' compiler. Newer versions
  409. of 'gcc' are designed to work with the 'gcov' tool instead.
  410. If the program was compiled with basic-block counting enabled, this
  411. option will also identify how many times each line of code was
  412. executed. While line-by-line profiling can help isolate where in a
  413. large function a program is spending its time, it also
  414. significantly increases the running time of 'gprof', and magnifies
  415. statistical inaccuracies. *Note Statistical Sampling Error:
  416. Sampling Error.
  417. '--inline-file-names'
  418. This option causes 'gprof' to print the source file after each
  419. symbol in both the flat profile and the call graph. The full path
  420. to the file is printed if used with the '-L' option.
  421. '-m NUM'
  422. '--min-count=NUM'
  423. This option affects execution count output only. Symbols that are
  424. executed less than NUM times are suppressed.
  425. '-nSYMSPEC'
  426. '--time=SYMSPEC'
  427. The '-n' option causes 'gprof', in its call graph analysis, to only
  428. propagate times for symbols matching SYMSPEC.
  429. '-NSYMSPEC'
  430. '--no-time=SYMSPEC'
  431. The '-n' option causes 'gprof', in its call graph analysis, not to
  432. propagate times for symbols matching SYMSPEC.
  433. '-SFILENAME'
  434. '--external-symbol-table=FILENAME'
  435. The '-S' option causes 'gprof' to read an external symbol table
  436. file, such as '/proc/kallsyms', rather than read the symbol table
  437. from the given object file (the default is 'a.out'). This is
  438. useful for profiling kernel modules.
  439. '-z'
  440. '--display-unused-functions'
  441. If you give the '-z' option, 'gprof' will mention all functions in
  442. the flat profile, even those that were never called, and that had
  443. no time spent in them. This is useful in conjunction with the '-c'
  444. option for discovering which routines were never called.
  445. 
  446. File: gprof.info, Node: Miscellaneous Options, Next: Deprecated Options, Prev: Analysis Options, Up: Invoking
  447. 4.3 Miscellaneous Options
  448. =========================
  449. '-d[NUM]'
  450. '--debug[=NUM]'
  451. The '-d NUM' option specifies debugging options. If NUM is not
  452. specified, enable all debugging. *Note Debugging 'gprof':
  453. Debugging.
  454. '-h'
  455. '--help'
  456. The '-h' option prints command line usage.
  457. '-ONAME'
  458. '--file-format=NAME'
  459. Selects the format of the profile data files. Recognized formats
  460. are 'auto' (the default), 'bsd', '4.4bsd', 'magic', and 'prof' (not
  461. yet supported).
  462. '-s'
  463. '--sum'
  464. The '-s' option causes 'gprof' to summarize the information in the
  465. profile data files it read in, and write out a profile data file
  466. called 'gmon.sum', which contains all the information from the
  467. profile data files that 'gprof' read in. The file 'gmon.sum' may
  468. be one of the specified input files; the effect of this is to merge
  469. the data in the other input files into 'gmon.sum'.
  470. Eventually you can run 'gprof' again without '-s' to analyze the
  471. cumulative data in the file 'gmon.sum'.
  472. '-v'
  473. '--version'
  474. The '-v' flag causes 'gprof' to print the current version number,
  475. and then exit.
  476. 
  477. File: gprof.info, Node: Deprecated Options, Next: Symspecs, Prev: Miscellaneous Options, Up: Invoking
  478. 4.4 Deprecated Options
  479. ======================
  480. These options have been replaced with newer versions that use symspecs.
  481. '-e FUNCTION_NAME'
  482. The '-e FUNCTION' option tells 'gprof' to not print information
  483. about the function FUNCTION_NAME (and its children...) in the call
  484. graph. The function will still be listed as a child of any
  485. functions that call it, but its index number will be shown as '[not
  486. printed]'. More than one '-e' option may be given; only one
  487. FUNCTION_NAME may be indicated with each '-e' option.
  488. '-E FUNCTION_NAME'
  489. The '-E FUNCTION' option works like the '-e' option, but time spent
  490. in the function (and children who were not called from anywhere
  491. else), will not be used to compute the percentages-of-time for the
  492. call graph. More than one '-E' option may be given; only one
  493. FUNCTION_NAME may be indicated with each '-E' option.
  494. '-f FUNCTION_NAME'
  495. The '-f FUNCTION' option causes 'gprof' to limit the call graph to
  496. the function FUNCTION_NAME and its children (and their
  497. children...). More than one '-f' option may be given; only one
  498. FUNCTION_NAME may be indicated with each '-f' option.
  499. '-F FUNCTION_NAME'
  500. The '-F FUNCTION' option works like the '-f' option, but only time
  501. spent in the function and its children (and their children...) will
  502. be used to determine total-time and percentages-of-time for the
  503. call graph. More than one '-F' option may be given; only one
  504. FUNCTION_NAME may be indicated with each '-F' option. The '-F'
  505. option overrides the '-E' option.
  506. Note that only one function can be specified with each '-e', '-E',
  507. '-f' or '-F' option. To specify more than one function, use multiple
  508. options. For example, this command:
  509. gprof -e boring -f foo -f bar myprogram > gprof.output
  510. lists in the call graph all functions that were reached from either
  511. 'foo' or 'bar' and were not reachable from 'boring'.
  512. 
  513. File: gprof.info, Node: Symspecs, Prev: Deprecated Options, Up: Invoking
  514. 4.5 Symspecs
  515. ============
  516. Many of the output options allow functions to be included or excluded
  517. using "symspecs" (symbol specifications), which observe the following
  518. syntax:
  519. filename_containing_a_dot
  520. | funcname_not_containing_a_dot
  521. | linenumber
  522. | ( [ any_filename ] `:' ( any_funcname | linenumber ) )
  523. Here are some sample symspecs:
  524. 'main.c'
  525. Selects everything in file 'main.c'--the dot in the string tells
  526. 'gprof' to interpret the string as a filename, rather than as a
  527. function name. To select a file whose name does not contain a dot,
  528. a trailing colon should be specified. For example, 'odd:' is
  529. interpreted as the file named 'odd'.
  530. 'main'
  531. Selects all functions named 'main'.
  532. Note that there may be multiple instances of the same function name
  533. because some of the definitions may be local (i.e., static).
  534. Unless a function name is unique in a program, you must use the
  535. colon notation explained below to specify a function from a
  536. specific source file.
  537. Sometimes, function names contain dots. In such cases, it is
  538. necessary to add a leading colon to the name. For example, ':.mul'
  539. selects function '.mul'.
  540. In some object file formats, symbols have a leading underscore.
  541. 'gprof' will normally not print these underscores. When you name a
  542. symbol in a symspec, you should type it exactly as 'gprof' prints
  543. it in its output. For example, if the compiler produces a symbol
  544. '_main' from your 'main' function, 'gprof' still prints it as
  545. 'main' in its output, so you should use 'main' in symspecs.
  546. 'main.c:main'
  547. Selects function 'main' in file 'main.c'.
  548. 'main.c:134'
  549. Selects line 134 in file 'main.c'.
  550. 
  551. File: gprof.info, Node: Output, Next: Inaccuracy, Prev: Invoking, Up: Top
  552. 5 Interpreting 'gprof''s Output
  553. *******************************
  554. 'gprof' can produce several different output styles, the most important
  555. of which are described below. The simplest output styles (file
  556. information, execution count, and function and file ordering) are not
  557. described here, but are documented with the respective options that
  558. trigger them. *Note Output Options: Output Options.
  559. * Menu:
  560. * Flat Profile:: The flat profile shows how much time was spent
  561. executing directly in each function.
  562. * Call Graph:: The call graph shows which functions called which
  563. others, and how much time each function used
  564. when its subroutine calls are included.
  565. * Line-by-line:: 'gprof' can analyze individual source code lines
  566. * Annotated Source:: The annotated source listing displays source code
  567. labeled with execution counts
  568. 
  569. File: gprof.info, Node: Flat Profile, Next: Call Graph, Up: Output
  570. 5.1 The Flat Profile
  571. ====================
  572. The "flat profile" shows the total amount of time your program spent
  573. executing each function. Unless the '-z' option is given, functions
  574. with no apparent time spent in them, and no apparent calls to them, are
  575. not mentioned. Note that if a function was not compiled for profiling,
  576. and didn't run long enough to show up on the program counter histogram,
  577. it will be indistinguishable from a function that was never called.
  578. This is part of a flat profile for a small program:
  579. Flat profile:
  580. Each sample counts as 0.01 seconds.
  581. % cumulative self self total
  582. time seconds seconds calls ms/call ms/call name
  583. 33.34 0.02 0.02 7208 0.00 0.00 open
  584. 16.67 0.03 0.01 244 0.04 0.12 offtime
  585. 16.67 0.04 0.01 8 1.25 1.25 memccpy
  586. 16.67 0.05 0.01 7 1.43 1.43 write
  587. 16.67 0.06 0.01 mcount
  588. 0.00 0.06 0.00 236 0.00 0.00 tzset
  589. 0.00 0.06 0.00 192 0.00 0.00 tolower
  590. 0.00 0.06 0.00 47 0.00 0.00 strlen
  591. 0.00 0.06 0.00 45 0.00 0.00 strchr
  592. 0.00 0.06 0.00 1 0.00 50.00 main
  593. 0.00 0.06 0.00 1 0.00 0.00 memcpy
  594. 0.00 0.06 0.00 1 0.00 10.11 print
  595. 0.00 0.06 0.00 1 0.00 0.00 profil
  596. 0.00 0.06 0.00 1 0.00 50.00 report
  597. ...
  598. The functions are sorted first by decreasing run-time spent in them,
  599. then by decreasing number of calls, then alphabetically by name. The
  600. functions 'mcount' and 'profil' are part of the profiling apparatus and
  601. appear in every flat profile; their time gives a measure of the amount
  602. of overhead due to profiling.
  603. Just before the column headers, a statement appears indicating how
  604. much time each sample counted as. This "sampling period" estimates the
  605. margin of error in each of the time figures. A time figure that is not
  606. much larger than this is not reliable. In this example, each sample
  607. counted as 0.01 seconds, suggesting a 100 Hz sampling rate. The
  608. program's total execution time was 0.06 seconds, as indicated by the
  609. 'cumulative seconds' field. Since each sample counted for 0.01 seconds,
  610. this means only six samples were taken during the run. Two of the
  611. samples occurred while the program was in the 'open' function, as
  612. indicated by the 'self seconds' field. Each of the other four samples
  613. occurred one each in 'offtime', 'memccpy', 'write', and 'mcount'. Since
  614. only six samples were taken, none of these values can be regarded as
  615. particularly reliable. In another run, the 'self seconds' field for
  616. 'mcount' might well be '0.00' or '0.02'. *Note Statistical Sampling
  617. Error: Sampling Error, for a complete discussion.
  618. The remaining functions in the listing (those whose 'self seconds'
  619. field is '0.00') didn't appear in the histogram samples at all.
  620. However, the call graph indicated that they were called, so therefore
  621. they are listed, sorted in decreasing order by the 'calls' field.
  622. Clearly some time was spent executing these functions, but the paucity
  623. of histogram samples prevents any determination of how much time each
  624. took.
  625. Here is what the fields in each line mean:
  626. '% time'
  627. This is the percentage of the total execution time your program
  628. spent in this function. These should all add up to 100%.
  629. 'cumulative seconds'
  630. This is the cumulative total number of seconds the computer spent
  631. executing this functions, plus the time spent in all the functions
  632. above this one in this table.
  633. 'self seconds'
  634. This is the number of seconds accounted for by this function alone.
  635. The flat profile listing is sorted first by this number.
  636. 'calls'
  637. This is the total number of times the function was called. If the
  638. function was never called, or the number of times it was called
  639. cannot be determined (probably because the function was not
  640. compiled with profiling enabled), the "calls" field is blank.
  641. 'self ms/call'
  642. This represents the average number of milliseconds spent in this
  643. function per call, if this function is profiled. Otherwise, this
  644. field is blank for this function.
  645. 'total ms/call'
  646. This represents the average number of milliseconds spent in this
  647. function and its descendants per call, if this function is
  648. profiled. Otherwise, this field is blank for this function. This
  649. is the only field in the flat profile that uses call graph
  650. analysis.
  651. 'name'
  652. This is the name of the function. The flat profile is sorted by
  653. this field alphabetically after the "self seconds" and "calls"
  654. fields are sorted.
  655. 
  656. File: gprof.info, Node: Call Graph, Next: Line-by-line, Prev: Flat Profile, Up: Output
  657. 5.2 The Call Graph
  658. ==================
  659. The "call graph" shows how much time was spent in each function and its
  660. children. From this information, you can find functions that, while
  661. they themselves may not have used much time, called other functions that
  662. did use unusual amounts of time.
  663. Here is a sample call from a small program. This call came from the
  664. same 'gprof' run as the flat profile example in the previous section.
  665. granularity: each sample hit covers 2 byte(s) for 20.00% of 0.05 seconds
  666. index % time self children called name
  667. <spontaneous>
  668. [1] 100.0 0.00 0.05 start [1]
  669. 0.00 0.05 1/1 main [2]
  670. 0.00 0.00 1/2 on_exit [28]
  671. 0.00 0.00 1/1 exit [59]
  672. -----------------------------------------------
  673. 0.00 0.05 1/1 start [1]
  674. [2] 100.0 0.00 0.05 1 main [2]
  675. 0.00 0.05 1/1 report [3]
  676. -----------------------------------------------
  677. 0.00 0.05 1/1 main [2]
  678. [3] 100.0 0.00 0.05 1 report [3]
  679. 0.00 0.03 8/8 timelocal [6]
  680. 0.00 0.01 1/1 print [9]
  681. 0.00 0.01 9/9 fgets [12]
  682. 0.00 0.00 12/34 strncmp <cycle 1> [40]
  683. 0.00 0.00 8/8 lookup [20]
  684. 0.00 0.00 1/1 fopen [21]
  685. 0.00 0.00 8/8 chewtime [24]
  686. 0.00 0.00 8/16 skipspace [44]
  687. -----------------------------------------------
  688. [4] 59.8 0.01 0.02 8+472 <cycle 2 as a whole> [4]
  689. 0.01 0.02 244+260 offtime <cycle 2> [7]
  690. 0.00 0.00 236+1 tzset <cycle 2> [26]
  691. -----------------------------------------------
  692. The lines full of dashes divide this table into "entries", one for
  693. each function. Each entry has one or more lines.
  694. In each entry, the primary line is the one that starts with an index
  695. number in square brackets. The end of this line says which function the
  696. entry is for. The preceding lines in the entry describe the callers of
  697. this function and the following lines describe its subroutines (also
  698. called "children" when we speak of the call graph).
  699. The entries are sorted by time spent in the function and its
  700. subroutines.
  701. The internal profiling function 'mcount' (*note The Flat Profile:
  702. Flat Profile.) is never mentioned in the call graph.
  703. * Menu:
  704. * Primary:: Details of the primary line's contents.
  705. * Callers:: Details of caller-lines' contents.
  706. * Subroutines:: Details of subroutine-lines' contents.
  707. * Cycles:: When there are cycles of recursion,
  708. such as 'a' calls 'b' calls 'a'...
  709. 
  710. File: gprof.info, Node: Primary, Next: Callers, Up: Call Graph
  711. 5.2.1 The Primary Line
  712. ----------------------
  713. The "primary line" in a call graph entry is the line that describes the
  714. function which the entry is about and gives the overall statistics for
  715. this function.
  716. For reference, we repeat the primary line from the entry for function
  717. 'report' in our main example, together with the heading line that shows
  718. the names of the fields:
  719. index % time self children called name
  720. ...
  721. [3] 100.0 0.00 0.05 1 report [3]
  722. Here is what the fields in the primary line mean:
  723. 'index'
  724. Entries are numbered with consecutive integers. Each function
  725. therefore has an index number, which appears at the beginning of
  726. its primary line.
  727. Each cross-reference to a function, as a caller or subroutine of
  728. another, gives its index number as well as its name. The index
  729. number guides you if you wish to look for the entry for that
  730. function.
  731. '% time'
  732. This is the percentage of the total time that was spent in this
  733. function, including time spent in subroutines called from this
  734. function.
  735. The time spent in this function is counted again for the callers of
  736. this function. Therefore, adding up these percentages is
  737. meaningless.
  738. 'self'
  739. This is the total amount of time spent in this function. This
  740. should be identical to the number printed in the 'seconds' field
  741. for this function in the flat profile.
  742. 'children'
  743. This is the total amount of time spent in the subroutine calls made
  744. by this function. This should be equal to the sum of all the
  745. 'self' and 'children' entries of the children listed directly below
  746. this function.
  747. 'called'
  748. This is the number of times the function was called.
  749. If the function called itself recursively, there are two numbers,
  750. separated by a '+'. The first number counts non-recursive calls,
  751. and the second counts recursive calls.
  752. In the example above, the function 'report' was called once from
  753. 'main'.
  754. 'name'
  755. This is the name of the current function. The index number is
  756. repeated after it.
  757. If the function is part of a cycle of recursion, the cycle number
  758. is printed between the function's name and the index number (*note
  759. How Mutually Recursive Functions Are Described: Cycles.). For
  760. example, if function 'gnurr' is part of cycle number one, and has
  761. index number twelve, its primary line would be end like this:
  762. gnurr <cycle 1> [12]
  763. 
  764. File: gprof.info, Node: Callers, Next: Subroutines, Prev: Primary, Up: Call Graph
  765. 5.2.2 Lines for a Function's Callers
  766. ------------------------------------
  767. A function's entry has a line for each function it was called by. These
  768. lines' fields correspond to the fields of the primary line, but their
  769. meanings are different because of the difference in context.
  770. For reference, we repeat two lines from the entry for the function
  771. 'report', the primary line and one caller-line preceding it, together
  772. with the heading line that shows the names of the fields:
  773. index % time self children called name
  774. ...
  775. 0.00 0.05 1/1 main [2]
  776. [3] 100.0 0.00 0.05 1 report [3]
  777. Here are the meanings of the fields in the caller-line for 'report'
  778. called from 'main':
  779. 'self'
  780. An estimate of the amount of time spent in 'report' itself when it
  781. was called from 'main'.
  782. 'children'
  783. An estimate of the amount of time spent in subroutines of 'report'
  784. when 'report' was called from 'main'.
  785. The sum of the 'self' and 'children' fields is an estimate of the
  786. amount of time spent within calls to 'report' from 'main'.
  787. 'called'
  788. Two numbers: the number of times 'report' was called from 'main',
  789. followed by the total number of non-recursive calls to 'report'
  790. from all its callers.
  791. 'name and index number'
  792. The name of the caller of 'report' to which this line applies,
  793. followed by the caller's index number.
  794. Not all functions have entries in the call graph; some options to
  795. 'gprof' request the omission of certain functions. When a caller
  796. has no entry of its own, it still has caller-lines in the entries
  797. of the functions it calls.
  798. If the caller is part of a recursion cycle, the cycle number is
  799. printed between the name and the index number.
  800. If the identity of the callers of a function cannot be determined, a
  801. dummy caller-line is printed which has '<spontaneous>' as the "caller's
  802. name" and all other fields blank. This can happen for signal handlers.
  803. 
  804. File: gprof.info, Node: Subroutines, Next: Cycles, Prev: Callers, Up: Call Graph
  805. 5.2.3 Lines for a Function's Subroutines
  806. ----------------------------------------
  807. A function's entry has a line for each of its subroutines--in other
  808. words, a line for each other function that it called. These lines'
  809. fields correspond to the fields of the primary line, but their meanings
  810. are different because of the difference in context.
  811. For reference, we repeat two lines from the entry for the function
  812. 'main', the primary line and a line for a subroutine, together with the
  813. heading line that shows the names of the fields:
  814. index % time self children called name
  815. ...
  816. [2] 100.0 0.00 0.05 1 main [2]
  817. 0.00 0.05 1/1 report [3]
  818. Here are the meanings of the fields in the subroutine-line for 'main'
  819. calling 'report':
  820. 'self'
  821. An estimate of the amount of time spent directly within 'report'
  822. when 'report' was called from 'main'.
  823. 'children'
  824. An estimate of the amount of time spent in subroutines of 'report'
  825. when 'report' was called from 'main'.
  826. The sum of the 'self' and 'children' fields is an estimate of the
  827. total time spent in calls to 'report' from 'main'.
  828. 'called'
  829. Two numbers, the number of calls to 'report' from 'main' followed
  830. by the total number of non-recursive calls to 'report'. This ratio
  831. is used to determine how much of 'report''s 'self' and 'children'
  832. time gets credited to 'main'. *Note Estimating 'children' Times:
  833. Assumptions.
  834. 'name'
  835. The name of the subroutine of 'main' to which this line applies,
  836. followed by the subroutine's index number.
  837. If the caller is part of a recursion cycle, the cycle number is
  838. printed between the name and the index number.
  839. 
  840. File: gprof.info, Node: Cycles, Prev: Subroutines, Up: Call Graph
  841. 5.2.4 How Mutually Recursive Functions Are Described
  842. ----------------------------------------------------
  843. The graph may be complicated by the presence of "cycles of recursion" in
  844. the call graph. A cycle exists if a function calls another function
  845. that (directly or indirectly) calls (or appears to call) the original
  846. function. For example: if 'a' calls 'b', and 'b' calls 'a', then 'a'
  847. and 'b' form a cycle.
  848. Whenever there are call paths both ways between a pair of functions,
  849. they belong to the same cycle. If 'a' and 'b' call each other and 'b'
  850. and 'c' call each other, all three make one cycle. Note that even if
  851. 'b' only calls 'a' if it was not called from 'a', 'gprof' cannot
  852. determine this, so 'a' and 'b' are still considered a cycle.
  853. The cycles are numbered with consecutive integers. When a function
  854. belongs to a cycle, each time the function name appears in the call
  855. graph it is followed by '<cycle NUMBER>'.
  856. The reason cycles matter is that they make the time values in the
  857. call graph paradoxical. The "time spent in children" of 'a' should
  858. include the time spent in its subroutine 'b' and in 'b''s
  859. subroutines--but one of 'b''s subroutines is 'a'! How much of 'a''s
  860. time should be included in the children of 'a', when 'a' is indirectly
  861. recursive?
  862. The way 'gprof' resolves this paradox is by creating a single entry
  863. for the cycle as a whole. The primary line of this entry describes the
  864. total time spent directly in the functions of the cycle. The
  865. "subroutines" of the cycle are the individual functions of the cycle,
  866. and all other functions that were called directly by them. The
  867. "callers" of the cycle are the functions, outside the cycle, that called
  868. functions in the cycle.
  869. Here is an example portion of a call graph which shows a cycle
  870. containing functions 'a' and 'b'. The cycle was entered by a call to
  871. 'a' from 'main'; both 'a' and 'b' called 'c'.
  872. index % time self children called name
  873. ----------------------------------------
  874. 1.77 0 1/1 main [2]
  875. [3] 91.71 1.77 0 1+5 <cycle 1 as a whole> [3]
  876. 1.02 0 3 b <cycle 1> [4]
  877. 0.75 0 2 a <cycle 1> [5]
  878. ----------------------------------------
  879. 3 a <cycle 1> [5]
  880. [4] 52.85 1.02 0 0 b <cycle 1> [4]
  881. 2 a <cycle 1> [5]
  882. 0 0 3/6 c [6]
  883. ----------------------------------------
  884. 1.77 0 1/1 main [2]
  885. 2 b <cycle 1> [4]
  886. [5] 38.86 0.75 0 1 a <cycle 1> [5]
  887. 3 b <cycle 1> [4]
  888. 0 0 3/6 c [6]
  889. ----------------------------------------
  890. (The entire call graph for this program contains in addition an entry
  891. for 'main', which calls 'a', and an entry for 'c', with callers 'a' and
  892. 'b'.)
  893. index % time self children called name
  894. <spontaneous>
  895. [1] 100.00 0 1.93 0 start [1]
  896. 0.16 1.77 1/1 main [2]
  897. ----------------------------------------
  898. 0.16 1.77 1/1 start [1]
  899. [2] 100.00 0.16 1.77 1 main [2]
  900. 1.77 0 1/1 a <cycle 1> [5]
  901. ----------------------------------------
  902. 1.77 0 1/1 main [2]
  903. [3] 91.71 1.77 0 1+5 <cycle 1 as a whole> [3]
  904. 1.02 0 3 b <cycle 1> [4]
  905. 0.75 0 2 a <cycle 1> [5]
  906. 0 0 6/6 c [6]
  907. ----------------------------------------
  908. 3 a <cycle 1> [5]
  909. [4] 52.85 1.02 0 0 b <cycle 1> [4]
  910. 2 a <cycle 1> [5]
  911. 0 0 3/6 c [6]
  912. ----------------------------------------
  913. 1.77 0 1/1 main [2]
  914. 2 b <cycle 1> [4]
  915. [5] 38.86 0.75 0 1 a <cycle 1> [5]
  916. 3 b <cycle 1> [4]
  917. 0 0 3/6 c [6]
  918. ----------------------------------------
  919. 0 0 3/6 b <cycle 1> [4]
  920. 0 0 3/6 a <cycle 1> [5]
  921. [6] 0.00 0 0 6 c [6]
  922. ----------------------------------------
  923. The 'self' field of the cycle's primary line is the total time spent
  924. in all the functions of the cycle. It equals the sum of the 'self'
  925. fields for the individual functions in the cycle, found in the entry in
  926. the subroutine lines for these functions.
  927. The 'children' fields of the cycle's primary line and subroutine
  928. lines count only subroutines outside the cycle. Even though 'a' calls
  929. 'b', the time spent in those calls to 'b' is not counted in 'a''s
  930. 'children' time. Thus, we do not encounter the problem of what to do
  931. when the time in those calls to 'b' includes indirect recursive calls
  932. back to 'a'.
  933. The 'children' field of a caller-line in the cycle's entry estimates
  934. the amount of time spent _in the whole cycle_, and its other
  935. subroutines, on the times when that caller called a function in the
  936. cycle.
  937. The 'called' field in the primary line for the cycle has two numbers:
  938. first, the number of times functions in the cycle were called by
  939. functions outside the cycle; second, the number of times they were
  940. called by functions in the cycle (including times when a function in the
  941. cycle calls itself). This is a generalization of the usual split into
  942. non-recursive and recursive calls.
  943. The 'called' field of a subroutine-line for a cycle member in the
  944. cycle's entry says how many time that function was called from functions
  945. in the cycle. The total of all these is the second number in the
  946. primary line's 'called' field.
  947. In the individual entry for a function in a cycle, the other
  948. functions in the same cycle can appear as subroutines and as callers.
  949. These lines show how many times each function in the cycle called or was
  950. called from each other function in the cycle. The 'self' and 'children'
  951. fields in these lines are blank because of the difficulty of defining
  952. meanings for them when recursion is going on.
  953. 
  954. File: gprof.info, Node: Line-by-line, Next: Annotated Source, Prev: Call Graph, Up: Output
  955. 5.3 Line-by-line Profiling
  956. ==========================
  957. 'gprof''s '-l' option causes the program to perform "line-by-line"
  958. profiling. In this mode, histogram samples are assigned not to
  959. functions, but to individual lines of source code. This only works with
  960. programs compiled with older versions of the 'gcc' compiler. Newer
  961. versions of 'gcc' use a different program - 'gcov' - to display
  962. line-by-line profiling information.
  963. With the older versions of 'gcc' the program usually has to be
  964. compiled with a '-g' option, in addition to '-pg', in order to generate
  965. debugging symbols for tracking source code lines. Note, in much older
  966. versions of 'gcc' the program had to be compiled with the '-a'
  967. command-line option as well.
  968. The flat profile is the most useful output table in line-by-line
  969. mode. The call graph isn't as useful as normal, since the current
  970. version of 'gprof' does not propagate call graph arcs from source code
  971. lines to the enclosing function. The call graph does, however, show
  972. each line of code that called each function, along with a count.
  973. Here is a section of 'gprof''s output, without line-by-line
  974. profiling. Note that 'ct_init' accounted for four histogram hits, and
  975. 13327 calls to 'init_block'.
  976. Flat profile:
  977. Each sample counts as 0.01 seconds.
  978. % cumulative self self total
  979. time seconds seconds calls us/call us/call name
  980. 30.77 0.13 0.04 6335 6.31 6.31 ct_init
  981. Call graph (explanation follows)
  982. granularity: each sample hit covers 4 byte(s) for 7.69% of 0.13 seconds
  983. index % time self children called name
  984. 0.00 0.00 1/13496 name_too_long
  985. 0.00 0.00 40/13496 deflate
  986. 0.00 0.00 128/13496 deflate_fast
  987. 0.00 0.00 13327/13496 ct_init
  988. [7] 0.0 0.00 0.00 13496 init_block
  989. Now let's look at some of 'gprof''s output from the same program run,
  990. this time with line-by-line profiling enabled. Note that 'ct_init''s
  991. four histogram hits are broken down into four lines of source code--one
  992. hit occurred on each of lines 349, 351, 382 and 385. In the call graph,
  993. note how 'ct_init''s 13327 calls to 'init_block' are broken down into
  994. one call from line 396, 3071 calls from line 384, 3730 calls from line
  995. 385, and 6525 calls from 387.
  996. Flat profile:
  997. Each sample counts as 0.01 seconds.
  998. % cumulative self
  999. time seconds seconds calls name
  1000. 7.69 0.10 0.01 ct_init (trees.c:349)
  1001. 7.69 0.11 0.01 ct_init (trees.c:351)
  1002. 7.69 0.12 0.01 ct_init (trees.c:382)
  1003. 7.69 0.13 0.01 ct_init (trees.c:385)
  1004. Call graph (explanation follows)
  1005. granularity: each sample hit covers 4 byte(s) for 7.69% of 0.13 seconds
  1006. % time self children called name
  1007. 0.00 0.00 1/13496 name_too_long (gzip.c:1440)
  1008. 0.00 0.00 1/13496 deflate (deflate.c:763)
  1009. 0.00 0.00 1/13496 ct_init (trees.c:396)
  1010. 0.00 0.00 2/13496 deflate (deflate.c:727)
  1011. 0.00 0.00 4/13496 deflate (deflate.c:686)
  1012. 0.00 0.00 5/13496 deflate (deflate.c:675)
  1013. 0.00 0.00 12/13496 deflate (deflate.c:679)
  1014. 0.00 0.00 16/13496 deflate (deflate.c:730)
  1015. 0.00 0.00 128/13496 deflate_fast (deflate.c:654)
  1016. 0.00 0.00 3071/13496 ct_init (trees.c:384)
  1017. 0.00 0.00 3730/13496 ct_init (trees.c:385)
  1018. 0.00 0.00 6525/13496 ct_init (trees.c:387)
  1019. [6] 0.0 0.00 0.00 13496 init_block (trees.c:408)
  1020. 
  1021. File: gprof.info, Node: Annotated Source, Prev: Line-by-line, Up: Output
  1022. 5.4 The Annotated Source Listing
  1023. ================================
  1024. 'gprof''s '-A' option triggers an annotated source listing, which lists
  1025. the program's source code, each function labeled with the number of
  1026. times it was called. You may also need to specify the '-I' option, if
  1027. 'gprof' can't find the source code files.
  1028. With older versions of 'gcc' compiling with 'gcc ... -g -pg -a'
  1029. augments your program with basic-block counting code, in addition to
  1030. function counting code. This enables 'gprof' to determine how many
  1031. times each line of code was executed. With newer versions of 'gcc'
  1032. support for displaying basic-block counts is provided by the 'gcov'
  1033. program.
  1034. For example, consider the following function, taken from gzip, with
  1035. line numbers added:
  1036. 1 ulg updcrc(s, n)
  1037. 2 uch *s;
  1038. 3 unsigned n;
  1039. 4 {
  1040. 5 register ulg c;
  1041. 6
  1042. 7 static ulg crc = (ulg)0xffffffffL;
  1043. 8
  1044. 9 if (s == NULL) {
  1045. 10 c = 0xffffffffL;
  1046. 11 } else {
  1047. 12 c = crc;
  1048. 13 if (n) do {
  1049. 14 c = crc_32_tab[...];
  1050. 15 } while (--n);
  1051. 16 }
  1052. 17 crc = c;
  1053. 18 return c ^ 0xffffffffL;
  1054. 19 }
  1055. 'updcrc' has at least five basic-blocks. One is the function itself.
  1056. The 'if' statement on line 9 generates two more basic-blocks, one for
  1057. each branch of the 'if'. A fourth basic-block results from the 'if' on
  1058. line 13, and the contents of the 'do' loop form the fifth basic-block.
  1059. The compiler may also generate additional basic-blocks to handle various
  1060. special cases.
  1061. A program augmented for basic-block counting can be analyzed with
  1062. 'gprof -l -A'. The '-x' option is also helpful, to ensure that each
  1063. line of code is labeled at least once. Here is 'updcrc''s annotated
  1064. source listing for a sample 'gzip' run:
  1065. ulg updcrc(s, n)
  1066. uch *s;
  1067. unsigned n;
  1068. 2 ->{
  1069. register ulg c;
  1070. static ulg crc = (ulg)0xffffffffL;
  1071. 2 -> if (s == NULL) {
  1072. 1 -> c = 0xffffffffL;
  1073. 1 -> } else {
  1074. 1 -> c = crc;
  1075. 1 -> if (n) do {
  1076. 26312 -> c = crc_32_tab[...];
  1077. 26312,1,26311 -> } while (--n);
  1078. }
  1079. 2 -> crc = c;
  1080. 2 -> return c ^ 0xffffffffL;
  1081. 2 ->}
  1082. In this example, the function was called twice, passing once through
  1083. each branch of the 'if' statement. The body of the 'do' loop was
  1084. executed a total of 26312 times. Note how the 'while' statement is
  1085. annotated. It began execution 26312 times, once for each iteration
  1086. through the loop. One of those times (the last time) it exited, while
  1087. it branched back to the beginning of the loop 26311 times.
  1088. 
  1089. File: gprof.info, Node: Inaccuracy, Next: How do I?, Prev: Output, Up: Top
  1090. 6 Inaccuracy of 'gprof' Output
  1091. ******************************
  1092. * Menu:
  1093. * Sampling Error:: Statistical margins of error
  1094. * Assumptions:: Estimating children times
  1095. 
  1096. File: gprof.info, Node: Sampling Error, Next: Assumptions, Up: Inaccuracy
  1097. 6.1 Statistical Sampling Error
  1098. ==============================
  1099. The run-time figures that 'gprof' gives you are based on a sampling
  1100. process, so they are subject to statistical inaccuracy. If a function
  1101. runs only a small amount of time, so that on the average the sampling
  1102. process ought to catch that function in the act only once, there is a
  1103. pretty good chance it will actually find that function zero times, or
  1104. twice.
  1105. By contrast, the number-of-calls and basic-block figures are derived
  1106. by counting, not sampling. They are completely accurate and will not
  1107. vary from run to run if your program is deterministic and single
  1108. threaded. In multi-threaded applications, or single threaded
  1109. applications that link with multi-threaded libraries, the counts are
  1110. only deterministic if the counting function is thread-safe. (Note:
  1111. beware that the mcount counting function in glibc is _not_ thread-safe).
  1112. *Note Implementation of Profiling: Implementation.
  1113. The "sampling period" that is printed at the beginning of the flat
  1114. profile says how often samples are taken. The rule of thumb is that a
  1115. run-time figure is accurate if it is considerably bigger than the
  1116. sampling period.
  1117. The actual amount of error can be predicted. For N samples, the
  1118. _expected_ error is the square-root of N. For example, if the sampling
  1119. period is 0.01 seconds and 'foo''s run-time is 1 second, N is 100
  1120. samples (1 second/0.01 seconds), sqrt(N) is 10 samples, so the expected
  1121. error in 'foo''s run-time is 0.1 seconds (10*0.01 seconds), or ten
  1122. percent of the observed value. Again, if the sampling period is 0.01
  1123. seconds and 'bar''s run-time is 100 seconds, N is 10000 samples, sqrt(N)
  1124. is 100 samples, so the expected error in 'bar''s run-time is 1 second,
  1125. or one percent of the observed value. It is likely to vary this much
  1126. _on the average_ from one profiling run to the next. (_Sometimes_ it
  1127. will vary more.)
  1128. This does not mean that a small run-time figure is devoid of
  1129. information. If the program's _total_ run-time is large, a small
  1130. run-time for one function does tell you that that function used an
  1131. insignificant fraction of the whole program's time. Usually this means
  1132. it is not worth optimizing.
  1133. One way to get more accuracy is to give your program more (but
  1134. similar) input data so it will take longer. Another way is to combine
  1135. the data from several runs, using the '-s' option of 'gprof'. Here is
  1136. how:
  1137. 1. Run your program once.
  1138. 2. Issue the command 'mv gmon.out gmon.sum'.
  1139. 3. Run your program again, the same as before.
  1140. 4. Merge the new data in 'gmon.out' into 'gmon.sum' with this command:
  1141. gprof -s EXECUTABLE-FILE gmon.out gmon.sum
  1142. 5. Repeat the last two steps as often as you wish.
  1143. 6. Analyze the cumulative data using this command:
  1144. gprof EXECUTABLE-FILE gmon.sum > OUTPUT-FILE
  1145. 
  1146. File: gprof.info, Node: Assumptions, Prev: Sampling Error, Up: Inaccuracy
  1147. 6.2 Estimating 'children' Times
  1148. ===============================
  1149. Some of the figures in the call graph are estimates--for example, the
  1150. 'children' time values and all the time figures in caller and subroutine
  1151. lines.
  1152. There is no direct information about these measurements in the
  1153. profile data itself. Instead, 'gprof' estimates them by making an
  1154. assumption about your program that might or might not be true.
  1155. The assumption made is that the average time spent in each call to
  1156. any function 'foo' is not correlated with who called 'foo'. If 'foo'
  1157. used 5 seconds in all, and 2/5 of the calls to 'foo' came from 'a', then
  1158. 'foo' contributes 2 seconds to 'a''s 'children' time, by assumption.
  1159. This assumption is usually true enough, but for some programs it is
  1160. far from true. Suppose that 'foo' returns very quickly when its
  1161. argument is zero; suppose that 'a' always passes zero as an argument,
  1162. while other callers of 'foo' pass other arguments. In this program, all
  1163. the time spent in 'foo' is in the calls from callers other than 'a'.
  1164. But 'gprof' has no way of knowing this; it will blindly and incorrectly
  1165. charge 2 seconds of time in 'foo' to the children of 'a'.
  1166. We hope some day to put more complete data into 'gmon.out', so that
  1167. this assumption is no longer needed, if we can figure out how. For the
  1168. novice, the estimated figures are usually more useful than misleading.
  1169. 
  1170. File: gprof.info, Node: How do I?, Next: Incompatibilities, Prev: Inaccuracy, Up: Top
  1171. 7 Answers to Common Questions
  1172. *****************************
  1173. How can I get more exact information about hot spots in my program?
  1174. Looking at the per-line call counts only tells part of the story.
  1175. Because 'gprof' can only report call times and counts by function,
  1176. the best way to get finer-grained information on where the program
  1177. is spending its time is to re-factor large functions into sequences
  1178. of calls to smaller ones. Beware however that this can introduce
  1179. artificial hot spots since compiling with '-pg' adds a significant
  1180. overhead to function calls. An alternative solution is to use a
  1181. non-intrusive profiler, e.g. oprofile.
  1182. How do I find which lines in my program were executed the most times?
  1183. Use the 'gcov' program.
  1184. How do I find which lines in my program called a particular function?
  1185. Use 'gprof -l' and lookup the function in the call graph. The
  1186. callers will be broken down by function and line number.
  1187. How do I analyze a program that runs for less than a second?
  1188. Try using a shell script like this one:
  1189. for i in `seq 1 100`; do
  1190. fastprog
  1191. mv gmon.out gmon.out.$i
  1192. done
  1193. gprof -s fastprog gmon.out.*
  1194. gprof fastprog gmon.sum
  1195. If your program is completely deterministic, all the call counts
  1196. will be simple multiples of 100 (i.e., a function called once in
  1197. each run will appear with a call count of 100).
  1198. 
  1199. File: gprof.info, Node: Incompatibilities, Next: Details, Prev: How do I?, Up: Top
  1200. 8 Incompatibilities with Unix 'gprof'
  1201. *************************************
  1202. GNU 'gprof' and Berkeley Unix 'gprof' use the same data file 'gmon.out',
  1203. and provide essentially the same information. But there are a few
  1204. differences.
  1205. * GNU 'gprof' uses a new, generalized file format with support for
  1206. basic-block execution counts and non-realtime histograms. A magic
  1207. cookie and version number allows 'gprof' to easily identify new
  1208. style files. Old BSD-style files can still be read. *Note
  1209. Profiling Data File Format: File Format.
  1210. * For a recursive function, Unix 'gprof' lists the function as a
  1211. parent and as a child, with a 'calls' field that lists the number
  1212. of recursive calls. GNU 'gprof' omits these lines and puts the
  1213. number of recursive calls in the primary line.
  1214. * When a function is suppressed from the call graph with '-e', GNU
  1215. 'gprof' still lists it as a subroutine of functions that call it.
  1216. * GNU 'gprof' accepts the '-k' with its argument in the form
  1217. 'from/to', instead of 'from to'.
  1218. * In the annotated source listing, if there are multiple basic blocks
  1219. on the same line, GNU 'gprof' prints all of their counts, separated
  1220. by commas.
  1221. * The blurbs, field widths, and output formats are different. GNU
  1222. 'gprof' prints blurbs after the tables, so that you can see the
  1223. tables without skipping the blurbs.
  1224. 
  1225. File: gprof.info, Node: Details, Next: GNU Free Documentation License, Prev: Incompatibilities, Up: Top
  1226. 9 Details of Profiling
  1227. **********************
  1228. * Menu:
  1229. * Implementation:: How a program collects profiling information
  1230. * File Format:: Format of 'gmon.out' files
  1231. * Internals:: 'gprof''s internal operation
  1232. * Debugging:: Using 'gprof''s '-d' option
  1233. 
  1234. File: gprof.info, Node: Implementation, Next: File Format, Up: Details
  1235. 9.1 Implementation of Profiling
  1236. ===============================
  1237. Profiling works by changing how every function in your program is
  1238. compiled so that when it is called, it will stash away some information
  1239. about where it was called from. From this, the profiler can figure out
  1240. what function called it, and can count how many times it was called.
  1241. This change is made by the compiler when your program is compiled with
  1242. the '-pg' option, which causes every function to call 'mcount' (or
  1243. '_mcount', or '__mcount', depending on the OS and compiler) as one of
  1244. its first operations.
  1245. The 'mcount' routine, included in the profiling library, is
  1246. responsible for recording in an in-memory call graph table both its
  1247. parent routine (the child) and its parent's parent. This is typically
  1248. done by examining the stack frame to find both the address of the child,
  1249. and the return address in the original parent. Since this is a very
  1250. machine-dependent operation, 'mcount' itself is typically a short
  1251. assembly-language stub routine that extracts the required information,
  1252. and then calls '__mcount_internal' (a normal C function) with two
  1253. arguments--'frompc' and 'selfpc'. '__mcount_internal' is responsible
  1254. for maintaining the in-memory call graph, which records 'frompc',
  1255. 'selfpc', and the number of times each of these call arcs was traversed.
  1256. GCC Version 2 provides a magical function
  1257. ('__builtin_return_address'), which allows a generic 'mcount' function
  1258. to extract the required information from the stack frame. However, on
  1259. some architectures, most notably the SPARC, using this builtin can be
  1260. very computationally expensive, and an assembly language version of
  1261. 'mcount' is used for performance reasons.
  1262. Number-of-calls information for library routines is collected by
  1263. using a special version of the C library. The programs in it are the
  1264. same as in the usual C library, but they were compiled with '-pg'. If
  1265. you link your program with 'gcc ... -pg', it automatically uses the
  1266. profiling version of the library.
  1267. Profiling also involves watching your program as it runs, and keeping
  1268. a histogram of where the program counter happens to be every now and
  1269. then. Typically the program counter is looked at around 100 times per
  1270. second of run time, but the exact frequency may vary from system to
  1271. system.
  1272. This is done is one of two ways. Most UNIX-like operating systems
  1273. provide a 'profil()' system call, which registers a memory array with
  1274. the kernel, along with a scale factor that determines how the program's
  1275. address space maps into the array. Typical scaling values cause every 2
  1276. to 8 bytes of address space to map into a single array slot. On every
  1277. tick of the system clock (assuming the profiled program is running), the
  1278. value of the program counter is examined and the corresponding slot in
  1279. the memory array is incremented. Since this is done in the kernel,
  1280. which had to interrupt the process anyway to handle the clock interrupt,
  1281. very little additional system overhead is required.
  1282. However, some operating systems, most notably Linux 2.0 (and
  1283. earlier), do not provide a 'profil()' system call. On such a system,
  1284. arrangements are made for the kernel to periodically deliver a signal to
  1285. the process (typically via 'setitimer()'), which then performs the same
  1286. operation of examining the program counter and incrementing a slot in
  1287. the memory array. Since this method requires a signal to be delivered
  1288. to user space every time a sample is taken, it uses considerably more
  1289. overhead than kernel-based profiling. Also, due to the added delay
  1290. required to deliver the signal, this method is less accurate as well.
  1291. A special startup routine allocates memory for the histogram and
  1292. either calls 'profil()' or sets up a clock signal handler. This routine
  1293. ('monstartup') can be invoked in several ways. On Linux systems, a
  1294. special profiling startup file 'gcrt0.o', which invokes 'monstartup'
  1295. before 'main', is used instead of the default 'crt0.o'. Use of this
  1296. special startup file is one of the effects of using 'gcc ... -pg' to
  1297. link. On SPARC systems, no special startup files are used. Rather, the
  1298. 'mcount' routine, when it is invoked for the first time (typically when
  1299. 'main' is called), calls 'monstartup'.
  1300. If the compiler's '-a' option was used, basic-block counting is also
  1301. enabled. Each object file is then compiled with a static array of
  1302. counts, initially zero. In the executable code, every time a new
  1303. basic-block begins (i.e., when an 'if' statement appears), an extra
  1304. instruction is inserted to increment the corresponding count in the
  1305. array. At compile time, a paired array was constructed that recorded
  1306. the starting address of each basic-block. Taken together, the two
  1307. arrays record the starting address of every basic-block, along with the
  1308. number of times it was executed.
  1309. The profiling library also includes a function ('mcleanup') which is
  1310. typically registered using 'atexit()' to be called as the program exits,
  1311. and is responsible for writing the file 'gmon.out'. Profiling is turned
  1312. off, various headers are output, and the histogram is written, followed
  1313. by the call-graph arcs and the basic-block counts.
  1314. The output from 'gprof' gives no indication of parts of your program
  1315. that are limited by I/O or swapping bandwidth. This is because samples
  1316. of the program counter are taken at fixed intervals of the program's run
  1317. time. Therefore, the time measurements in 'gprof' output say nothing
  1318. about time that your program was not running. For example, a part of
  1319. the program that creates so much data that it cannot all fit in physical
  1320. memory at once may run very slowly due to thrashing, but 'gprof' will
  1321. say it uses little time. On the other hand, sampling by run time has
  1322. the advantage that the amount of load due to other users won't directly
  1323. affect the output you get.
  1324. 
  1325. File: gprof.info, Node: File Format, Next: Internals, Prev: Implementation, Up: Details
  1326. 9.2 Profiling Data File Format
  1327. ==============================
  1328. The old BSD-derived file format used for profile data does not contain a
  1329. magic cookie that allows to check whether a data file really is a
  1330. 'gprof' file. Furthermore, it does not provide a version number, thus
  1331. rendering changes to the file format almost impossible. GNU 'gprof'
  1332. uses a new file format that provides these features. For backward
  1333. compatibility, GNU 'gprof' continues to support the old BSD-derived
  1334. format, but not all features are supported with it. For example,
  1335. basic-block execution counts cannot be accommodated by the old file
  1336. format.
  1337. The new file format is defined in header file 'gmon_out.h'. It
  1338. consists of a header containing the magic cookie and a version number,
  1339. as well as some spare bytes available for future extensions. All data
  1340. in a profile data file is in the native format of the target for which
  1341. the profile was collected. GNU 'gprof' adapts automatically to the
  1342. byte-order in use.
  1343. In the new file format, the header is followed by a sequence of
  1344. records. Currently, there are three different record types: histogram
  1345. records, call-graph arc records, and basic-block execution count
  1346. records. Each file can contain any number of each record type. When
  1347. reading a file, GNU 'gprof' will ensure records of the same type are
  1348. compatible with each other and compute the union of all records. For
  1349. example, for basic-block execution counts, the union is simply the sum
  1350. of all execution counts for each basic-block.
  1351. 9.2.1 Histogram Records
  1352. -----------------------
  1353. Histogram records consist of a header that is followed by an array of
  1354. bins. The header contains the text-segment range that the histogram
  1355. spans, the size of the histogram in bytes (unlike in the old BSD format,
  1356. this does not include the size of the header), the rate of the profiling
  1357. clock, and the physical dimension that the bin counts represent after
  1358. being scaled by the profiling clock rate. The physical dimension is
  1359. specified in two parts: a long name of up to 15 characters and a single
  1360. character abbreviation. For example, a histogram representing real-time
  1361. would specify the long name as "seconds" and the abbreviation as "s".
  1362. This feature is useful for architectures that support performance
  1363. monitor hardware (which, fortunately, is becoming increasingly common).
  1364. For example, under DEC OSF/1, the "uprofile" command can be used to
  1365. produce a histogram of, say, instruction cache misses. In this case,
  1366. the dimension in the histogram header could be set to "i-cache misses"
  1367. and the abbreviation could be set to "1" (because it is simply a count,
  1368. not a physical dimension). Also, the profiling rate would have to be
  1369. set to 1 in this case.
  1370. Histogram bins are 16-bit numbers and each bin represent an equal
  1371. amount of text-space. For example, if the text-segment is one thousand
  1372. bytes long and if there are ten bins in the histogram, each bin
  1373. represents one hundred bytes.
  1374. 9.2.2 Call-Graph Records
  1375. ------------------------
  1376. Call-graph records have a format that is identical to the one used in
  1377. the BSD-derived file format. It consists of an arc in the call graph
  1378. and a count indicating the number of times the arc was traversed during
  1379. program execution. Arcs are specified by a pair of addresses: the first
  1380. must be within caller's function and the second must be within the
  1381. callee's function. When performing profiling at the function level,
  1382. these addresses can point anywhere within the respective function.
  1383. However, when profiling at the line-level, it is better if the addresses
  1384. are as close to the call-site/entry-point as possible. This will ensure
  1385. that the line-level call-graph is able to identify exactly which line of
  1386. source code performed calls to a function.
  1387. 9.2.3 Basic-Block Execution Count Records
  1388. -----------------------------------------
  1389. Basic-block execution count records consist of a header followed by a
  1390. sequence of address/count pairs. The header simply specifies the length
  1391. of the sequence. In an address/count pair, the address identifies a
  1392. basic-block and the count specifies the number of times that basic-block
  1393. was executed. Any address within the basic-address can be used.
  1394. 
  1395. File: gprof.info, Node: Internals, Next: Debugging, Prev: File Format, Up: Details
  1396. 9.3 'gprof''s Internal Operation
  1397. ================================
  1398. Like most programs, 'gprof' begins by processing its options. During
  1399. this stage, it may building its symspec list ('sym_ids.c:sym_id_add'),
  1400. if options are specified which use symspecs. 'gprof' maintains a single
  1401. linked list of symspecs, which will eventually get turned into 12 symbol
  1402. tables, organized into six include/exclude pairs--one pair each for the
  1403. flat profile (INCL_FLAT/EXCL_FLAT), the call graph arcs
  1404. (INCL_ARCS/EXCL_ARCS), printing in the call graph
  1405. (INCL_GRAPH/EXCL_GRAPH), timing propagation in the call graph
  1406. (INCL_TIME/EXCL_TIME), the annotated source listing
  1407. (INCL_ANNO/EXCL_ANNO), and the execution count listing
  1408. (INCL_EXEC/EXCL_EXEC).
  1409. After option processing, 'gprof' finishes building the symspec list
  1410. by adding all the symspecs in 'default_excluded_list' to the exclude
  1411. lists EXCL_TIME and EXCL_GRAPH, and if line-by-line profiling is
  1412. specified, EXCL_FLAT as well. These default excludes are not added to
  1413. EXCL_ANNO, EXCL_ARCS, and EXCL_EXEC.
  1414. Next, the BFD library is called to open the object file, verify that
  1415. it is an object file, and read its symbol table ('core.c:core_init'),
  1416. using 'bfd_canonicalize_symtab' after mallocing an appropriately sized
  1417. array of symbols. At this point, function mappings are read (if the
  1418. '--file-ordering' option has been specified), and the core text space is
  1419. read into memory (if the '-c' option was given).
  1420. 'gprof''s own symbol table, an array of Sym structures, is now built.
  1421. This is done in one of two ways, by one of two routines, depending on
  1422. whether line-by-line profiling ('-l' option) has been enabled. For
  1423. normal profiling, the BFD canonical symbol table is scanned. For
  1424. line-by-line profiling, every text space address is examined, and a new
  1425. symbol table entry gets created every time the line number changes. In
  1426. either case, two passes are made through the symbol table--one to count
  1427. the size of the symbol table required, and the other to actually read
  1428. the symbols. In between the two passes, a single array of type 'Sym' is
  1429. created of the appropriate length. Finally, 'symtab.c:symtab_finalize'
  1430. is called to sort the symbol table and remove duplicate entries (entries
  1431. with the same memory address).
  1432. The symbol table must be a contiguous array for two reasons. First,
  1433. the 'qsort' library function (which sorts an array) will be used to sort
  1434. the symbol table. Also, the symbol lookup routine
  1435. ('symtab.c:sym_lookup'), which finds symbols based on memory address,
  1436. uses a binary search algorithm which requires the symbol table to be a
  1437. sorted array. Function symbols are indicated with an 'is_func' flag.
  1438. Line number symbols have no special flags set. Additionally, a symbol
  1439. can have an 'is_static' flag to indicate that it is a local symbol.
  1440. With the symbol table read, the symspecs can now be translated into
  1441. Syms ('sym_ids.c:sym_id_parse'). Remember that a single symspec can
  1442. match multiple symbols. An array of symbol tables ('syms') is created,
  1443. each entry of which is a symbol table of Syms to be included or excluded
  1444. from a particular listing. The master symbol table and the symspecs are
  1445. examined by nested loops, and every symbol that matches a symspec is
  1446. inserted into the appropriate syms table. This is done twice, once to
  1447. count the size of each required symbol table, and again to build the
  1448. tables, which have been malloced between passes. From now on, to
  1449. determine whether a symbol is on an include or exclude symspec list,
  1450. 'gprof' simply uses its standard symbol lookup routine on the
  1451. appropriate table in the 'syms' array.
  1452. Now the profile data file(s) themselves are read
  1453. ('gmon_io.c:gmon_out_read'), first by checking for a new-style
  1454. 'gmon.out' header, then assuming this is an old-style BSD 'gmon.out' if
  1455. the magic number test failed.
  1456. New-style histogram records are read by 'hist.c:hist_read_rec'. For
  1457. the first histogram record, allocate a memory array to hold all the
  1458. bins, and read them in. When multiple profile data files (or files with
  1459. multiple histogram records) are read, the memory ranges of each pair of
  1460. histogram records must be either equal, or non-overlapping. For each
  1461. pair of histogram records, the resolution (memory region size divided by
  1462. the number of bins) must be the same. The time unit must be the same
  1463. for all histogram records. If the above containts are met, all
  1464. histograms for the same memory range are merged.
  1465. As each call graph record is read ('call_graph.c:cg_read_rec'), the
  1466. parent and child addresses are matched to symbol table entries, and a
  1467. call graph arc is created by 'cg_arcs.c:arc_add', unless the arc fails a
  1468. symspec check against INCL_ARCS/EXCL_ARCS. As each arc is added, a
  1469. linked list is maintained of the parent's child arcs, and of the child's
  1470. parent arcs. Both the child's call count and the arc's call count are
  1471. incremented by the record's call count.
  1472. Basic-block records are read ('basic_blocks.c:bb_read_rec'), but only
  1473. if line-by-line profiling has been selected. Each basic-block address
  1474. is matched to a corresponding line symbol in the symbol table, and an
  1475. entry made in the symbol's bb_addr and bb_calls arrays. Again, if
  1476. multiple basic-block records are present for the same address, the call
  1477. counts are cumulative.
  1478. A gmon.sum file is dumped, if requested ('gmon_io.c:gmon_out_write').
  1479. If histograms were present in the data files, assign them to symbols
  1480. ('hist.c:hist_assign_samples') by iterating over all the sample bins and
  1481. assigning them to symbols. Since the symbol table is sorted in order of
  1482. ascending memory addresses, we can simple follow along in the symbol
  1483. table as we make our pass over the sample bins. This step includes a
  1484. symspec check against INCL_FLAT/EXCL_FLAT. Depending on the histogram
  1485. scale factor, a sample bin may span multiple symbols, in which case a
  1486. fraction of the sample count is allocated to each symbol, proportional
  1487. to the degree of overlap. This effect is rare for normal profiling, but
  1488. overlaps are more common during line-by-line profiling, and can cause
  1489. each of two adjacent lines to be credited with half a hit, for example.
  1490. If call graph data is present, 'cg_arcs.c:cg_assemble' is called.
  1491. First, if '-c' was specified, a machine-dependent routine ('find_call')
  1492. scans through each symbol's machine code, looking for subroutine call
  1493. instructions, and adding them to the call graph with a zero call count.
  1494. A topological sort is performed by depth-first numbering all the symbols
  1495. ('cg_dfn.c:cg_dfn'), so that children are always numbered less than
  1496. their parents, then making a array of pointers into the symbol table and
  1497. sorting it into numerical order, which is reverse topological order
  1498. (children appear before parents). Cycles are also detected at this
  1499. point, all members of which are assigned the same topological number.
  1500. Two passes are now made through this sorted array of symbol pointers.
  1501. The first pass, from end to beginning (parents to children), computes
  1502. the fraction of child time to propagate to each parent and a print flag.
  1503. The print flag reflects symspec handling of INCL_GRAPH/EXCL_GRAPH, with
  1504. a parent's include or exclude (print or no print) property being
  1505. propagated to its children, unless they themselves explicitly appear in
  1506. INCL_GRAPH or EXCL_GRAPH. A second pass, from beginning to end (children
  1507. to parents) actually propagates the timings along the call graph,
  1508. subject to a check against INCL_TIME/EXCL_TIME. With the print flag,
  1509. fractions, and timings now stored in the symbol structures, the
  1510. topological sort array is now discarded, and a new array of pointers is
  1511. assembled, this time sorted by propagated time.
  1512. Finally, print the various outputs the user requested, which is now
  1513. fairly straightforward. The call graph ('cg_print.c:cg_print') and flat
  1514. profile ('hist.c:hist_print') are regurgitations of values already
  1515. computed. The annotated source listing
  1516. ('basic_blocks.c:print_annotated_source') uses basic-block information,
  1517. if present, to label each line of code with call counts, otherwise only
  1518. the function call counts are presented.
  1519. The function ordering code is marginally well documented in the
  1520. source code itself ('cg_print.c'). Basically, the functions with the
  1521. most use and the most parents are placed first, followed by other
  1522. functions with the most use, followed by lower use functions, followed
  1523. by unused functions at the end.
  1524. 
  1525. File: gprof.info, Node: Debugging, Prev: Internals, Up: Details
  1526. 9.4 Debugging 'gprof'
  1527. =====================
  1528. If 'gprof' was compiled with debugging enabled, the '-d' option triggers
  1529. debugging output (to stdout) which can be helpful in understanding its
  1530. operation. The debugging number specified is interpreted as a sum of
  1531. the following options:
  1532. 2 - Topological sort
  1533. Monitor depth-first numbering of symbols during call graph analysis
  1534. 4 - Cycles
  1535. Shows symbols as they are identified as cycle heads
  1536. 16 - Tallying
  1537. As the call graph arcs are read, show each arc and how the total
  1538. calls to each function are tallied
  1539. 32 - Call graph arc sorting
  1540. Details sorting individual parents/children within each call graph
  1541. entry
  1542. 64 - Reading histogram and call graph records
  1543. Shows address ranges of histograms as they are read, and each call
  1544. graph arc
  1545. 128 - Symbol table
  1546. Reading, classifying, and sorting the symbol table from the object
  1547. file. For line-by-line profiling ('-l' option), also shows line
  1548. numbers being assigned to memory addresses.
  1549. 256 - Static call graph
  1550. Trace operation of '-c' option
  1551. 512 - Symbol table and arc table lookups
  1552. Detail operation of lookup routines
  1553. 1024 - Call graph propagation
  1554. Shows how function times are propagated along the call graph
  1555. 2048 - Basic-blocks
  1556. Shows basic-block records as they are read from profile data (only
  1557. meaningful with '-l' option)
  1558. 4096 - Symspecs
  1559. Shows symspec-to-symbol pattern matching operation
  1560. 8192 - Annotate source
  1561. Tracks operation of '-A' option
  1562. 
  1563. File: gprof.info, Node: GNU Free Documentation License, Prev: Details, Up: Top
  1564. Appendix A GNU Free Documentation License
  1565. *****************************************
  1566. Version 1.3, 3 November 2008
  1567. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  1568. <http://fsf.org/>
  1569. Everyone is permitted to copy and distribute verbatim copies
  1570. of this license document, but changing it is not allowed.
  1571. 0. PREAMBLE
  1572. The purpose of this License is to make a manual, textbook, or other
  1573. functional and useful document "free" in the sense of freedom: to
  1574. assure everyone the effective freedom to copy and redistribute it,
  1575. with or without modifying it, either commercially or
  1576. noncommercially. Secondarily, this License preserves for the
  1577. author and publisher a way to get credit for their work, while not
  1578. being considered responsible for modifications made by others.
  1579. This License is a kind of "copyleft", which means that derivative
  1580. works of the document must themselves be free in the same sense.
  1581. It complements the GNU General Public License, which is a copyleft
  1582. license designed for free software.
  1583. We have designed this License in order to use it for manuals for
  1584. free software, because free software needs free documentation: a
  1585. free program should come with manuals providing the same freedoms
  1586. that the software does. But this License is not limited to
  1587. software manuals; it can be used for any textual work, regardless
  1588. of subject matter or whether it is published as a printed book. We
  1589. recommend this License principally for works whose purpose is
  1590. instruction or reference.
  1591. 1. APPLICABILITY AND DEFINITIONS
  1592. This License applies to any manual or other work, in any medium,
  1593. that contains a notice placed by the copyright holder saying it can
  1594. be distributed under the terms of this License. Such a notice
  1595. grants a world-wide, royalty-free license, unlimited in duration,
  1596. to use that work under the conditions stated herein. The
  1597. "Document", below, refers to any such manual or work. Any member
  1598. of the public is a licensee, and is addressed as "you". You accept
  1599. the license if you copy, modify or distribute the work in a way
  1600. requiring permission under copyright law.
  1601. A "Modified Version" of the Document means any work containing the
  1602. Document or a portion of it, either copied verbatim, or with
  1603. modifications and/or translated into another language.
  1604. A "Secondary Section" is a named appendix or a front-matter section
  1605. of the Document that deals exclusively with the relationship of the
  1606. publishers or authors of the Document to the Document's overall
  1607. subject (or to related matters) and contains nothing that could
  1608. fall directly within that overall subject. (Thus, if the Document
  1609. is in part a textbook of mathematics, a Secondary Section may not
  1610. explain any mathematics.) The relationship could be a matter of
  1611. historical connection with the subject or with related matters, or
  1612. of legal, commercial, philosophical, ethical or political position
  1613. regarding them.
  1614. The "Invariant Sections" are certain Secondary Sections whose
  1615. titles are designated, as being those of Invariant Sections, in the
  1616. notice that says that the Document is released under this License.
  1617. If a section does not fit the above definition of Secondary then it
  1618. is not allowed to be designated as Invariant. The Document may
  1619. contain zero Invariant Sections. If the Document does not identify
  1620. any Invariant Sections then there are none.
  1621. The "Cover Texts" are certain short passages of text that are
  1622. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  1623. that says that the Document is released under this License. A
  1624. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  1625. be at most 25 words.
  1626. A "Transparent" copy of the Document means a machine-readable copy,
  1627. represented in a format whose specification is available to the
  1628. general public, that is suitable for revising the document
  1629. straightforwardly with generic text editors or (for images composed
  1630. of pixels) generic paint programs or (for drawings) some widely
  1631. available drawing editor, and that is suitable for input to text
  1632. formatters or for automatic translation to a variety of formats
  1633. suitable for input to text formatters. A copy made in an otherwise
  1634. Transparent file format whose markup, or absence of markup, has
  1635. been arranged to thwart or discourage subsequent modification by
  1636. readers is not Transparent. An image format is not Transparent if
  1637. used for any substantial amount of text. A copy that is not
  1638. "Transparent" is called "Opaque".
  1639. Examples of suitable formats for Transparent copies include plain
  1640. ASCII without markup, Texinfo input format, LaTeX input format,
  1641. SGML or XML using a publicly available DTD, and standard-conforming
  1642. simple HTML, PostScript or PDF designed for human modification.
  1643. Examples of transparent image formats include PNG, XCF and JPG.
  1644. Opaque formats include proprietary formats that can be read and
  1645. edited only by proprietary word processors, SGML or XML for which
  1646. the DTD and/or processing tools are not generally available, and
  1647. the machine-generated HTML, PostScript or PDF produced by some word
  1648. processors for output purposes only.
  1649. The "Title Page" means, for a printed book, the title page itself,
  1650. plus such following pages as are needed to hold, legibly, the
  1651. material this License requires to appear in the title page. For
  1652. works in formats which do not have any title page as such, "Title
  1653. Page" means the text near the most prominent appearance of the
  1654. work's title, preceding the beginning of the body of the text.
  1655. The "publisher" means any person or entity that distributes copies
  1656. of the Document to the public.
  1657. A section "Entitled XYZ" means a named subunit of the Document
  1658. whose title either is precisely XYZ or contains XYZ in parentheses
  1659. following text that translates XYZ in another language. (Here XYZ
  1660. stands for a specific section name mentioned below, such as
  1661. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  1662. To "Preserve the Title" of such a section when you modify the
  1663. Document means that it remains a section "Entitled XYZ" according
  1664. to this definition.
  1665. The Document may include Warranty Disclaimers next to the notice
  1666. which states that this License applies to the Document. These
  1667. Warranty Disclaimers are considered to be included by reference in
  1668. this License, but only as regards disclaiming warranties: any other
  1669. implication that these Warranty Disclaimers may have is void and
  1670. has no effect on the meaning of this License.
  1671. 2. VERBATIM COPYING
  1672. You may copy and distribute the Document in any medium, either
  1673. commercially or noncommercially, provided that this License, the
  1674. copyright notices, and the license notice saying this License
  1675. applies to the Document are reproduced in all copies, and that you
  1676. add no other conditions whatsoever to those of this License. You
  1677. may not use technical measures to obstruct or control the reading
  1678. or further copying of the copies you make or distribute. However,
  1679. you may accept compensation in exchange for copies. If you
  1680. distribute a large enough number of copies you must also follow the
  1681. conditions in section 3.
  1682. You may also lend copies, under the same conditions stated above,
  1683. and you may publicly display copies.
  1684. 3. COPYING IN QUANTITY
  1685. If you publish printed copies (or copies in media that commonly
  1686. have printed covers) of the Document, numbering more than 100, and
  1687. the Document's license notice requires Cover Texts, you must
  1688. enclose the copies in covers that carry, clearly and legibly, all
  1689. these Cover Texts: Front-Cover Texts on the front cover, and
  1690. Back-Cover Texts on the back cover. Both covers must also clearly
  1691. and legibly identify you as the publisher of these copies. The
  1692. front cover must present the full title with all words of the title
  1693. equally prominent and visible. You may add other material on the
  1694. covers in addition. Copying with changes limited to the covers, as
  1695. long as they preserve the title of the Document and satisfy these
  1696. conditions, can be treated as verbatim copying in other respects.
  1697. If the required texts for either cover are too voluminous to fit
  1698. legibly, you should put the first ones listed (as many as fit
  1699. reasonably) on the actual cover, and continue the rest onto
  1700. adjacent pages.
  1701. If you publish or distribute Opaque copies of the Document
  1702. numbering more than 100, you must either include a machine-readable
  1703. Transparent copy along with each Opaque copy, or state in or with
  1704. each Opaque copy a computer-network location from which the general
  1705. network-using public has access to download using public-standard
  1706. network protocols a complete Transparent copy of the Document, free
  1707. of added material. If you use the latter option, you must take
  1708. reasonably prudent steps, when you begin distribution of Opaque
  1709. copies in quantity, to ensure that this Transparent copy will
  1710. remain thus accessible at the stated location until at least one
  1711. year after the last time you distribute an Opaque copy (directly or
  1712. through your agents or retailers) of that edition to the public.
  1713. It is requested, but not required, that you contact the authors of
  1714. the Document well before redistributing any large number of copies,
  1715. to give them a chance to provide you with an updated version of the
  1716. Document.
  1717. 4. MODIFICATIONS
  1718. You may copy and distribute a Modified Version of the Document
  1719. under the conditions of sections 2 and 3 above, provided that you
  1720. release the Modified Version under precisely this License, with the
  1721. Modified Version filling the role of the Document, thus licensing
  1722. distribution and modification of the Modified Version to whoever
  1723. possesses a copy of it. In addition, you must do these things in
  1724. the Modified Version:
  1725. A. Use in the Title Page (and on the covers, if any) a title
  1726. distinct from that of the Document, and from those of previous
  1727. versions (which should, if there were any, be listed in the
  1728. History section of the Document). You may use the same title
  1729. as a previous version if the original publisher of that
  1730. version gives permission.
  1731. B. List on the Title Page, as authors, one or more persons or
  1732. entities responsible for authorship of the modifications in
  1733. the Modified Version, together with at least five of the
  1734. principal authors of the Document (all of its principal
  1735. authors, if it has fewer than five), unless they release you
  1736. from this requirement.
  1737. C. State on the Title page the name of the publisher of the
  1738. Modified Version, as the publisher.
  1739. D. Preserve all the copyright notices of the Document.
  1740. E. Add an appropriate copyright notice for your modifications
  1741. adjacent to the other copyright notices.
  1742. F. Include, immediately after the copyright notices, a license
  1743. notice giving the public permission to use the Modified
  1744. Version under the terms of this License, in the form shown in
  1745. the Addendum below.
  1746. G. Preserve in that license notice the full lists of Invariant
  1747. Sections and required Cover Texts given in the Document's
  1748. license notice.
  1749. H. Include an unaltered copy of this License.
  1750. I. Preserve the section Entitled "History", Preserve its Title,
  1751. and add to it an item stating at least the title, year, new
  1752. authors, and publisher of the Modified Version as given on the
  1753. Title Page. If there is no section Entitled "History" in the
  1754. Document, create one stating the title, year, authors, and
  1755. publisher of the Document as given on its Title Page, then add
  1756. an item describing the Modified Version as stated in the
  1757. previous sentence.
  1758. J. Preserve the network location, if any, given in the Document
  1759. for public access to a Transparent copy of the Document, and
  1760. likewise the network locations given in the Document for
  1761. previous versions it was based on. These may be placed in the
  1762. "History" section. You may omit a network location for a work
  1763. that was published at least four years before the Document
  1764. itself, or if the original publisher of the version it refers
  1765. to gives permission.
  1766. K. For any section Entitled "Acknowledgements" or "Dedications",
  1767. Preserve the Title of the section, and preserve in the section
  1768. all the substance and tone of each of the contributor
  1769. acknowledgements and/or dedications given therein.
  1770. L. Preserve all the Invariant Sections of the Document, unaltered
  1771. in their text and in their titles. Section numbers or the
  1772. equivalent are not considered part of the section titles.
  1773. M. Delete any section Entitled "Endorsements". Such a section
  1774. may not be included in the Modified Version.
  1775. N. Do not retitle any existing section to be Entitled
  1776. "Endorsements" or to conflict in title with any Invariant
  1777. Section.
  1778. O. Preserve any Warranty Disclaimers.
  1779. If the Modified Version includes new front-matter sections or
  1780. appendices that qualify as Secondary Sections and contain no
  1781. material copied from the Document, you may at your option designate
  1782. some or all of these sections as invariant. To do this, add their
  1783. titles to the list of Invariant Sections in the Modified Version's
  1784. license notice. These titles must be distinct from any other
  1785. section titles.
  1786. You may add a section Entitled "Endorsements", provided it contains
  1787. nothing but endorsements of your Modified Version by various
  1788. parties--for example, statements of peer review or that the text
  1789. has been approved by an organization as the authoritative
  1790. definition of a standard.
  1791. You may add a passage of up to five words as a Front-Cover Text,
  1792. and a passage of up to 25 words as a Back-Cover Text, to the end of
  1793. the list of Cover Texts in the Modified Version. Only one passage
  1794. of Front-Cover Text and one of Back-Cover Text may be added by (or
  1795. through arrangements made by) any one entity. If the Document
  1796. already includes a cover text for the same cover, previously added
  1797. by you or by arrangement made by the same entity you are acting on
  1798. behalf of, you may not add another; but you may replace the old
  1799. one, on explicit permission from the previous publisher that added
  1800. the old one.
  1801. The author(s) and publisher(s) of the Document do not by this
  1802. License give permission to use their names for publicity for or to
  1803. assert or imply endorsement of any Modified Version.
  1804. 5. COMBINING DOCUMENTS
  1805. You may combine the Document with other documents released under
  1806. this License, under the terms defined in section 4 above for
  1807. modified versions, provided that you include in the combination all
  1808. of the Invariant Sections of all of the original documents,
  1809. unmodified, and list them all as Invariant Sections of your
  1810. combined work in its license notice, and that you preserve all
  1811. their Warranty Disclaimers.
  1812. The combined work need only contain one copy of this License, and
  1813. multiple identical Invariant Sections may be replaced with a single
  1814. copy. If there are multiple Invariant Sections with the same name
  1815. but different contents, make the title of each such section unique
  1816. by adding at the end of it, in parentheses, the name of the
  1817. original author or publisher of that section if known, or else a
  1818. unique number. Make the same adjustment to the section titles in
  1819. the list of Invariant Sections in the license notice of the
  1820. combined work.
  1821. In the combination, you must combine any sections Entitled
  1822. "History" in the various original documents, forming one section
  1823. Entitled "History"; likewise combine any sections Entitled
  1824. "Acknowledgements", and any sections Entitled "Dedications". You
  1825. must delete all sections Entitled "Endorsements."
  1826. 6. COLLECTIONS OF DOCUMENTS
  1827. You may make a collection consisting of the Document and other
  1828. documents released under this License, and replace the individual
  1829. copies of this License in the various documents with a single copy
  1830. that is included in the collection, provided that you follow the
  1831. rules of this License for verbatim copying of each of the documents
  1832. in all other respects.
  1833. You may extract a single document from such a collection, and
  1834. distribute it individually under this License, provided you insert
  1835. a copy of this License into the extracted document, and follow this
  1836. License in all other respects regarding verbatim copying of that
  1837. document.
  1838. 7. AGGREGATION WITH INDEPENDENT WORKS
  1839. A compilation of the Document or its derivatives with other
  1840. separate and independent documents or works, in or on a volume of a
  1841. storage or distribution medium, is called an "aggregate" if the
  1842. copyright resulting from the compilation is not used to limit the
  1843. legal rights of the compilation's users beyond what the individual
  1844. works permit. When the Document is included in an aggregate, this
  1845. License does not apply to the other works in the aggregate which
  1846. are not themselves derivative works of the Document.
  1847. If the Cover Text requirement of section 3 is applicable to these
  1848. copies of the Document, then if the Document is less than one half
  1849. of the entire aggregate, the Document's Cover Texts may be placed
  1850. on covers that bracket the Document within the aggregate, or the
  1851. electronic equivalent of covers if the Document is in electronic
  1852. form. Otherwise they must appear on printed covers that bracket
  1853. the whole aggregate.
  1854. 8. TRANSLATION
  1855. Translation is considered a kind of modification, so you may
  1856. distribute translations of the Document under the terms of section
  1857. 4. Replacing Invariant Sections with translations requires special
  1858. permission from their copyright holders, but you may include
  1859. translations of some or all Invariant Sections in addition to the
  1860. original versions of these Invariant Sections. You may include a
  1861. translation of this License, and all the license notices in the
  1862. Document, and any Warranty Disclaimers, provided that you also
  1863. include the original English version of this License and the
  1864. original versions of those notices and disclaimers. In case of a
  1865. disagreement between the translation and the original version of
  1866. this License or a notice or disclaimer, the original version will
  1867. prevail.
  1868. If a section in the Document is Entitled "Acknowledgements",
  1869. "Dedications", or "History", the requirement (section 4) to
  1870. Preserve its Title (section 1) will typically require changing the
  1871. actual title.
  1872. 9. TERMINATION
  1873. You may not copy, modify, sublicense, or distribute the Document
  1874. except as expressly provided under this License. Any attempt
  1875. otherwise to copy, modify, sublicense, or distribute it is void,
  1876. and will automatically terminate your rights under this License.
  1877. However, if you cease all violation of this License, then your
  1878. license from a particular copyright holder is reinstated (a)
  1879. provisionally, unless and until the copyright holder explicitly and
  1880. finally terminates your license, and (b) permanently, if the
  1881. copyright holder fails to notify you of the violation by some
  1882. reasonable means prior to 60 days after the cessation.
  1883. Moreover, your license from a particular copyright holder is
  1884. reinstated permanently if the copyright holder notifies you of the
  1885. violation by some reasonable means, this is the first time you have
  1886. received notice of violation of this License (for any work) from
  1887. that copyright holder, and you cure the violation prior to 30 days
  1888. after your receipt of the notice.
  1889. Termination of your rights under this section does not terminate
  1890. the licenses of parties who have received copies or rights from you
  1891. under this License. If your rights have been terminated and not
  1892. permanently reinstated, receipt of a copy of some or all of the
  1893. same material does not give you any rights to use it.
  1894. 10. FUTURE REVISIONS OF THIS LICENSE
  1895. The Free Software Foundation may publish new, revised versions of
  1896. the GNU Free Documentation License from time to time. Such new
  1897. versions will be similar in spirit to the present version, but may
  1898. differ in detail to address new problems or concerns. See
  1899. <http://www.gnu.org/copyleft/>.
  1900. Each version of the License is given a distinguishing version
  1901. number. If the Document specifies that a particular numbered
  1902. version of this License "or any later version" applies to it, you
  1903. have the option of following the terms and conditions either of
  1904. that specified version or of any later version that has been
  1905. published (not as a draft) by the Free Software Foundation. If the
  1906. Document does not specify a version number of this License, you may
  1907. choose any version ever published (not as a draft) by the Free
  1908. Software Foundation. If the Document specifies that a proxy can
  1909. decide which future versions of this License can be used, that
  1910. proxy's public statement of acceptance of a version permanently
  1911. authorizes you to choose that version for the Document.
  1912. 11. RELICENSING
  1913. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  1914. World Wide Web server that publishes copyrightable works and also
  1915. provides prominent facilities for anybody to edit those works. A
  1916. public wiki that anybody can edit is an example of such a server.
  1917. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  1918. site means any set of copyrightable works thus published on the MMC
  1919. site.
  1920. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  1921. license published by Creative Commons Corporation, a not-for-profit
  1922. corporation with a principal place of business in San Francisco,
  1923. California, as well as future copyleft versions of that license
  1924. published by that same organization.
  1925. "Incorporate" means to publish or republish a Document, in whole or
  1926. in part, as part of another Document.
  1927. An MMC is "eligible for relicensing" if it is licensed under this
  1928. License, and if all works that were first published under this
  1929. License somewhere other than this MMC, and subsequently
  1930. incorporated in whole or in part into the MMC, (1) had no cover
  1931. texts or invariant sections, and (2) were thus incorporated prior
  1932. to November 1, 2008.
  1933. The operator of an MMC Site may republish an MMC contained in the
  1934. site under CC-BY-SA on the same site at any time before August 1,
  1935. 2009, provided the MMC is eligible for relicensing.
  1936. ADDENDUM: How to use this License for your documents
  1937. ====================================================
  1938. To use this License in a document you have written, include a copy of
  1939. the License in the document and put the following copyright and license
  1940. notices just after the title page:
  1941. Copyright (C) YEAR YOUR NAME.
  1942. Permission is granted to copy, distribute and/or modify this document
  1943. under the terms of the GNU Free Documentation License, Version 1.3
  1944. or any later version published by the Free Software Foundation;
  1945. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  1946. Texts. A copy of the license is included in the section entitled ``GNU
  1947. Free Documentation License''.
  1948. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  1949. Texts, replace the "with...Texts." line with this:
  1950. with the Invariant Sections being LIST THEIR TITLES, with
  1951. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  1952. being LIST.
  1953. If you have Invariant Sections without Cover Texts, or some other
  1954. combination of the three, merge those two alternatives to suit the
  1955. situation.
  1956. If your document contains nontrivial examples of program code, we
  1957. recommend releasing these examples in parallel under your choice of free
  1958. software license, such as the GNU General Public License, to permit
  1959. their use in free software.
  1960. 
  1961. Tag Table:
  1962. Node: Top719
  1963. Node: Introduction2075
  1964. Node: Compiling4566
  1965. Node: Executing8622
  1966. Node: Invoking11410
  1967. Node: Output Options12825
  1968. Node: Analysis Options19917
  1969. Node: Miscellaneous Options23837
  1970. Node: Deprecated Options25091
  1971. Node: Symspecs27154
  1972. Node: Output28980
  1973. Node: Flat Profile30020
  1974. Node: Call Graph34973
  1975. Node: Primary38205
  1976. Node: Callers40793
  1977. Node: Subroutines42911
  1978. Node: Cycles44752
  1979. Node: Line-by-line51529
  1980. Node: Annotated Source55605
  1981. Node: Inaccuracy58603
  1982. Node: Sampling Error58861
  1983. Node: Assumptions61765
  1984. Node: How do I?63235
  1985. Node: Incompatibilities64792
  1986. Node: Details66286
  1987. Node: Implementation66679
  1988. Node: File Format72578
  1989. Node: Internals76866
  1990. Node: Debugging85356
  1991. Node: GNU Free Documentation License86946
  1992. 
  1993. End Tag Table