aarch64-none-linux-gnu-gprof.1 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .if !\nF .nr F 0
  58. .if \nF>0 \{\
  59. . de IX
  60. . tm Index:\\$1\t\\n%\t"\\$2"
  61. ..
  62. . if !\nF==2 \{\
  63. . nr % 0
  64. . nr F 2
  65. . \}
  66. .\}
  67. .\"
  68. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  69. .\" Fear. Run. Save yourself. No user-serviceable parts.
  70. . \" fudge factors for nroff and troff
  71. .if n \{\
  72. . ds #H 0
  73. . ds #V .8m
  74. . ds #F .3m
  75. . ds #[ \f1
  76. . ds #] \fP
  77. .\}
  78. .if t \{\
  79. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  80. . ds #V .6m
  81. . ds #F 0
  82. . ds #[ \&
  83. . ds #] \&
  84. .\}
  85. . \" simple accents for nroff and troff
  86. .if n \{\
  87. . ds ' \&
  88. . ds ` \&
  89. . ds ^ \&
  90. . ds , \&
  91. . ds ~ ~
  92. . ds /
  93. .\}
  94. .if t \{\
  95. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  96. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  97. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  98. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  99. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  100. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  101. .\}
  102. . \" troff and (daisy-wheel) nroff accents
  103. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  104. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  105. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  106. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  107. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  108. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  109. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  110. .ds ae a\h'-(\w'a'u*4/10)'e
  111. .ds Ae A\h'-(\w'A'u*4/10)'E
  112. . \" corrections for vroff
  113. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  114. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  115. . \" for low resolution devices (crt and lpr)
  116. .if \n(.H>23 .if \n(.V>19 \
  117. \{\
  118. . ds : e
  119. . ds 8 ss
  120. . ds o a
  121. . ds d- d\h'-1'\(ga
  122. . ds D- D\h'-1'\(hy
  123. . ds th \o'bp'
  124. . ds Th \o'LP'
  125. . ds ae ae
  126. . ds Ae AE
  127. .\}
  128. .rm #[ #] #H #V #F C
  129. .\" ========================================================================
  130. .\"
  131. .IX Title "GPROF 1"
  132. .TH GPROF 1 "2021-07-02" "binutils-2.36.1" "GNU"
  133. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  134. .\" way too many mistakes in technical documents.
  135. .if n .ad l
  136. .nh
  137. .SH "NAME"
  138. gprof \- display call graph profile data
  139. .SH "SYNOPSIS"
  140. .IX Header "SYNOPSIS"
  141. gprof [ \-[abcDhilLrsTvwxyz] ] [ \-[ACeEfFJnNOpPqQRStZ][\fIname\fR] ]
  142. [ \-I \fIdirs\fR ] [ \-d[\fInum\fR] ] [ \-k \fIfrom/to\fR ]
  143. [ \-m \fImin-count\fR ] [ \-R \fImap_file\fR ] [ \-t \fItable-length\fR ]
  144. [ \-\-[no\-]annotated\-source[=\fIname\fR] ]
  145. [ \-\-[no\-]exec\-counts[=\fIname\fR] ]
  146. [ \-\-[no\-]flat\-profile[=\fIname\fR] ] [ \-\-[no\-]graph[=\fIname\fR] ]
  147. [ \-\-[no\-]time=\fIname\fR] [ \-\-all\-lines ] [ \-\-brief ]
  148. [ \-\-debug[=\fIlevel\fR] ] [ \-\-function\-ordering ]
  149. [ \-\-file\-ordering \fImap_file\fR ] [ \-\-directory\-path=\fIdirs\fR ]
  150. [ \-\-display\-unused\-functions ] [ \-\-file\-format=\fIname\fR ]
  151. [ \-\-file\-info ] [ \-\-help ] [ \-\-line ] [ \-\-inline\-file\-names ]
  152. [ \-\-min\-count=\fIn\fR ] [ \-\-no\-static ] [ \-\-print\-path ]
  153. [ \-\-separate\-files ] [ \-\-static\-call\-graph ] [ \-\-sum ]
  154. [ \-\-table\-length=\fIlen\fR ] [ \-\-traditional ] [ \-\-version ]
  155. [ \-\-width=\fIn\fR ] [ \-\-ignore\-non\-functions ]
  156. [ \-\-demangle[=\fI\s-1STYLE\s0\fR] ] [ \-\-no\-demangle ]
  157. [\-\-external\-symbol\-table=name]
  158. [ \fIimage-file\fR ] [ \fIprofile-file\fR ... ]
  159. .SH "DESCRIPTION"
  160. .IX Header "DESCRIPTION"
  161. \&\f(CW\*(C`gprof\*(C'\fR produces an execution profile of C, Pascal, or Fortran77
  162. programs. The effect of called routines is incorporated in the profile
  163. of each caller. The profile data is taken from the call graph profile file
  164. (\fIgmon.out\fR default) which is created by programs
  165. that are compiled with the \fB\-pg\fR option of
  166. \&\f(CW\*(C`cc\*(C'\fR, \f(CW\*(C`pc\*(C'\fR, and \f(CW\*(C`f77\*(C'\fR.
  167. The \fB\-pg\fR option also links in versions of the library routines
  168. that are compiled for profiling. \f(CW\*(C`Gprof\*(C'\fR reads the given object
  169. file (the default is \f(CW\*(C`a.out\*(C'\fR) and establishes the relation between
  170. its symbol table and the call graph profile from \fIgmon.out\fR.
  171. If more than one profile file is specified, the \f(CW\*(C`gprof\*(C'\fR
  172. output shows the sum of the profile information in the given profile files.
  173. .PP
  174. \&\f(CW\*(C`Gprof\*(C'\fR calculates the amount of time spent in each routine.
  175. Next, these times are propagated along the edges of the call graph.
  176. Cycles are discovered, and calls into a cycle are made to share the time
  177. of the cycle.
  178. .PP
  179. Several forms of output are available from the analysis.
  180. .PP
  181. The \fIflat profile\fR shows how much time your program spent in each function,
  182. and how many times that function was called. If you simply want to know
  183. which functions burn most of the cycles, it is stated concisely here.
  184. .PP
  185. The \fIcall graph\fR shows, for each function, which functions called it, which
  186. other functions it called, and how many times. There is also an estimate
  187. of how much time was spent in the subroutines of each function. This can
  188. suggest places where you might try to eliminate function calls that use a
  189. lot of time.
  190. .PP
  191. The \fIannotated source\fR listing is a copy of the program's
  192. source code, labeled with the number of times each line of the
  193. program was executed.
  194. .SH "OPTIONS"
  195. .IX Header "OPTIONS"
  196. These options specify which of several output formats
  197. \&\f(CW\*(C`gprof\*(C'\fR should produce.
  198. .PP
  199. Many of these options take an optional \fIsymspec\fR to specify
  200. functions to be included or excluded. These options can be
  201. specified multiple times, with different symspecs, to include
  202. or exclude sets of symbols.
  203. .PP
  204. Specifying any of these options overrides the default (\fB\-p \-q\fR),
  205. which prints a flat profile and call graph analysis
  206. for all functions.
  207. .ie n .IP """\-A[\fIsymspec\fP]""" 4
  208. .el .IP "\f(CW\-A[\f(CIsymspec\f(CW]\fR" 4
  209. .IX Item "-A[symspec]"
  210. .PD 0
  211. .ie n .IP """\-\-annotated\-source[=\fIsymspec\fP]""" 4
  212. .el .IP "\f(CW\-\-annotated\-source[=\f(CIsymspec\f(CW]\fR" 4
  213. .IX Item "--annotated-source[=symspec]"
  214. .PD
  215. The \fB\-A\fR option causes \f(CW\*(C`gprof\*(C'\fR to print annotated source code.
  216. If \fIsymspec\fR is specified, print output only for matching symbols.
  217. .ie n .IP """\-b""" 4
  218. .el .IP "\f(CW\-b\fR" 4
  219. .IX Item "-b"
  220. .PD 0
  221. .ie n .IP """\-\-brief""" 4
  222. .el .IP "\f(CW\-\-brief\fR" 4
  223. .IX Item "--brief"
  224. .PD
  225. If the \fB\-b\fR option is given, \f(CW\*(C`gprof\*(C'\fR doesn't print the
  226. verbose blurbs that try to explain the meaning of all of the fields in
  227. the tables. This is useful if you intend to print out the output, or
  228. are tired of seeing the blurbs.
  229. .ie n .IP """\-C[\fIsymspec\fP]""" 4
  230. .el .IP "\f(CW\-C[\f(CIsymspec\f(CW]\fR" 4
  231. .IX Item "-C[symspec]"
  232. .PD 0
  233. .ie n .IP """\-\-exec\-counts[=\fIsymspec\fP]""" 4
  234. .el .IP "\f(CW\-\-exec\-counts[=\f(CIsymspec\f(CW]\fR" 4
  235. .IX Item "--exec-counts[=symspec]"
  236. .PD
  237. The \fB\-C\fR option causes \f(CW\*(C`gprof\*(C'\fR to
  238. print a tally of functions and the number of times each was called.
  239. If \fIsymspec\fR is specified, print tally only for matching symbols.
  240. .Sp
  241. If the profile data file contains basic-block count records, specifying
  242. the \fB\-l\fR option, along with \fB\-C\fR, will cause basic-block
  243. execution counts to be tallied and displayed.
  244. .ie n .IP """\-i""" 4
  245. .el .IP "\f(CW\-i\fR" 4
  246. .IX Item "-i"
  247. .PD 0
  248. .ie n .IP """\-\-file\-info""" 4
  249. .el .IP "\f(CW\-\-file\-info\fR" 4
  250. .IX Item "--file-info"
  251. .PD
  252. The \fB\-i\fR option causes \f(CW\*(C`gprof\*(C'\fR to display summary information
  253. about the profile data file(s) and then exit. The number of histogram,
  254. call graph, and basic-block count records is displayed.
  255. .ie n .IP """\-I \fIdirs\fP""" 4
  256. .el .IP "\f(CW\-I \f(CIdirs\f(CW\fR" 4
  257. .IX Item "-I dirs"
  258. .PD 0
  259. .ie n .IP """\-\-directory\-path=\fIdirs\fP""" 4
  260. .el .IP "\f(CW\-\-directory\-path=\f(CIdirs\f(CW\fR" 4
  261. .IX Item "--directory-path=dirs"
  262. .PD
  263. The \fB\-I\fR option specifies a list of search directories in
  264. which to find source files. Environment variable \fI\s-1GPROF_PATH\s0\fR
  265. can also be used to convey this information.
  266. Used mostly for annotated source output.
  267. .ie n .IP """\-J[\fIsymspec\fP]""" 4
  268. .el .IP "\f(CW\-J[\f(CIsymspec\f(CW]\fR" 4
  269. .IX Item "-J[symspec]"
  270. .PD 0
  271. .ie n .IP """\-\-no\-annotated\-source[=\fIsymspec\fP]""" 4
  272. .el .IP "\f(CW\-\-no\-annotated\-source[=\f(CIsymspec\f(CW]\fR" 4
  273. .IX Item "--no-annotated-source[=symspec]"
  274. .PD
  275. The \fB\-J\fR option causes \f(CW\*(C`gprof\*(C'\fR not to
  276. print annotated source code.
  277. If \fIsymspec\fR is specified, \f(CW\*(C`gprof\*(C'\fR prints annotated source,
  278. but excludes matching symbols.
  279. .ie n .IP """\-L""" 4
  280. .el .IP "\f(CW\-L\fR" 4
  281. .IX Item "-L"
  282. .PD 0
  283. .ie n .IP """\-\-print\-path""" 4
  284. .el .IP "\f(CW\-\-print\-path\fR" 4
  285. .IX Item "--print-path"
  286. .PD
  287. Normally, source filenames are printed with the path
  288. component suppressed. The \fB\-L\fR option causes \f(CW\*(C`gprof\*(C'\fR
  289. to print the full pathname of
  290. source filenames, which is determined
  291. from symbolic debugging information in the image file
  292. and is relative to the directory in which the compiler
  293. was invoked.
  294. .ie n .IP """\-p[\fIsymspec\fP]""" 4
  295. .el .IP "\f(CW\-p[\f(CIsymspec\f(CW]\fR" 4
  296. .IX Item "-p[symspec]"
  297. .PD 0
  298. .ie n .IP """\-\-flat\-profile[=\fIsymspec\fP]""" 4
  299. .el .IP "\f(CW\-\-flat\-profile[=\f(CIsymspec\f(CW]\fR" 4
  300. .IX Item "--flat-profile[=symspec]"
  301. .PD
  302. The \fB\-p\fR option causes \f(CW\*(C`gprof\*(C'\fR to print a flat profile.
  303. If \fIsymspec\fR is specified, print flat profile only for matching symbols.
  304. .ie n .IP """\-P[\fIsymspec\fP]""" 4
  305. .el .IP "\f(CW\-P[\f(CIsymspec\f(CW]\fR" 4
  306. .IX Item "-P[symspec]"
  307. .PD 0
  308. .ie n .IP """\-\-no\-flat\-profile[=\fIsymspec\fP]""" 4
  309. .el .IP "\f(CW\-\-no\-flat\-profile[=\f(CIsymspec\f(CW]\fR" 4
  310. .IX Item "--no-flat-profile[=symspec]"
  311. .PD
  312. The \fB\-P\fR option causes \f(CW\*(C`gprof\*(C'\fR to suppress printing a flat profile.
  313. If \fIsymspec\fR is specified, \f(CW\*(C`gprof\*(C'\fR prints a flat profile,
  314. but excludes matching symbols.
  315. .ie n .IP """\-q[\fIsymspec\fP]""" 4
  316. .el .IP "\f(CW\-q[\f(CIsymspec\f(CW]\fR" 4
  317. .IX Item "-q[symspec]"
  318. .PD 0
  319. .ie n .IP """\-\-graph[=\fIsymspec\fP]""" 4
  320. .el .IP "\f(CW\-\-graph[=\f(CIsymspec\f(CW]\fR" 4
  321. .IX Item "--graph[=symspec]"
  322. .PD
  323. The \fB\-q\fR option causes \f(CW\*(C`gprof\*(C'\fR to print the call graph analysis.
  324. If \fIsymspec\fR is specified, print call graph only for matching symbols
  325. and their children.
  326. .ie n .IP """\-Q[\fIsymspec\fP]""" 4
  327. .el .IP "\f(CW\-Q[\f(CIsymspec\f(CW]\fR" 4
  328. .IX Item "-Q[symspec]"
  329. .PD 0
  330. .ie n .IP """\-\-no\-graph[=\fIsymspec\fP]""" 4
  331. .el .IP "\f(CW\-\-no\-graph[=\f(CIsymspec\f(CW]\fR" 4
  332. .IX Item "--no-graph[=symspec]"
  333. .PD
  334. The \fB\-Q\fR option causes \f(CW\*(C`gprof\*(C'\fR to suppress printing the
  335. call graph.
  336. If \fIsymspec\fR is specified, \f(CW\*(C`gprof\*(C'\fR prints a call graph,
  337. but excludes matching symbols.
  338. .ie n .IP """\-t""" 4
  339. .el .IP "\f(CW\-t\fR" 4
  340. .IX Item "-t"
  341. .PD 0
  342. .ie n .IP """\-\-table\-length=\fInum\fP""" 4
  343. .el .IP "\f(CW\-\-table\-length=\f(CInum\f(CW\fR" 4
  344. .IX Item "--table-length=num"
  345. .PD
  346. The \fB\-t\fR option causes the \fInum\fR most active source lines in
  347. each source file to be listed when source annotation is enabled. The
  348. default is 10.
  349. .ie n .IP """\-y""" 4
  350. .el .IP "\f(CW\-y\fR" 4
  351. .IX Item "-y"
  352. .PD 0
  353. .ie n .IP """\-\-separate\-files""" 4
  354. .el .IP "\f(CW\-\-separate\-files\fR" 4
  355. .IX Item "--separate-files"
  356. .PD
  357. This option affects annotated source output only.
  358. Normally, \f(CW\*(C`gprof\*(C'\fR prints annotated source files
  359. to standard-output. If this option is specified,
  360. annotated source for a file named \fIpath/\fIfilename\fI\fR
  361. is generated in the file \fI\fIfilename\fI\-ann\fR. If the underlying
  362. file system would truncate \fI\fIfilename\fI\-ann\fR so that it
  363. overwrites the original \fI\fIfilename\fI\fR, \f(CW\*(C`gprof\*(C'\fR generates
  364. annotated source in the file \fI\fIfilename\fI.ann\fR instead (if the
  365. original file name has an extension, that extension is \fIreplaced\fR
  366. with \fI.ann\fR).
  367. .ie n .IP """\-Z[\fIsymspec\fP]""" 4
  368. .el .IP "\f(CW\-Z[\f(CIsymspec\f(CW]\fR" 4
  369. .IX Item "-Z[symspec]"
  370. .PD 0
  371. .ie n .IP """\-\-no\-exec\-counts[=\fIsymspec\fP]""" 4
  372. .el .IP "\f(CW\-\-no\-exec\-counts[=\f(CIsymspec\f(CW]\fR" 4
  373. .IX Item "--no-exec-counts[=symspec]"
  374. .PD
  375. The \fB\-Z\fR option causes \f(CW\*(C`gprof\*(C'\fR not to
  376. print a tally of functions and the number of times each was called.
  377. If \fIsymspec\fR is specified, print tally, but exclude matching symbols.
  378. .ie n .IP """\-r""" 4
  379. .el .IP "\f(CW\-r\fR" 4
  380. .IX Item "-r"
  381. .PD 0
  382. .ie n .IP """\-\-function\-ordering""" 4
  383. .el .IP "\f(CW\-\-function\-ordering\fR" 4
  384. .IX Item "--function-ordering"
  385. .PD
  386. The \fB\-\-function\-ordering\fR option causes \f(CW\*(C`gprof\*(C'\fR to print a
  387. suggested function ordering for the program based on profiling data.
  388. This option suggests an ordering which may improve paging, tlb and
  389. cache behavior for the program on systems which support arbitrary
  390. ordering of functions in an executable.
  391. .Sp
  392. The exact details of how to force the linker to place functions
  393. in a particular order is system dependent and out of the scope of this
  394. manual.
  395. .ie n .IP """\-R \fImap_file\fP""" 4
  396. .el .IP "\f(CW\-R \f(CImap_file\f(CW\fR" 4
  397. .IX Item "-R map_file"
  398. .PD 0
  399. .ie n .IP """\-\-file\-ordering \fImap_file\fP""" 4
  400. .el .IP "\f(CW\-\-file\-ordering \f(CImap_file\f(CW\fR" 4
  401. .IX Item "--file-ordering map_file"
  402. .PD
  403. The \fB\-\-file\-ordering\fR option causes \f(CW\*(C`gprof\*(C'\fR to print a
  404. suggested .o link line ordering for the program based on profiling data.
  405. This option suggests an ordering which may improve paging, tlb and
  406. cache behavior for the program on systems which do not support arbitrary
  407. ordering of functions in an executable.
  408. .Sp
  409. Use of the \fB\-a\fR argument is highly recommended with this option.
  410. .Sp
  411. The \fImap_file\fR argument is a pathname to a file which provides
  412. function name to object file mappings. The format of the file is similar to
  413. the output of the program \f(CW\*(C`nm\*(C'\fR.
  414. .Sp
  415. .Vb 8
  416. \& c\-parse.o:00000000 T yyparse
  417. \& c\-parse.o:00000004 C yyerrflag
  418. \& c\-lang.o:00000000 T maybe_objc_method_name
  419. \& c\-lang.o:00000000 T print_lang_statistics
  420. \& c\-lang.o:00000000 T recognize_objc_keyword
  421. \& c\-decl.o:00000000 T print_lang_identifier
  422. \& c\-decl.o:00000000 T print_lang_type
  423. \& ...
  424. .Ve
  425. .Sp
  426. To create a \fImap_file\fR with \s-1GNU\s0 \f(CW\*(C`nm\*(C'\fR, type a command like
  427. \&\f(CW\*(C`nm \-\-extern\-only \-\-defined\-only \-v \-\-print\-file\-name program\-name\*(C'\fR.
  428. .ie n .IP """\-T""" 4
  429. .el .IP "\f(CW\-T\fR" 4
  430. .IX Item "-T"
  431. .PD 0
  432. .ie n .IP """\-\-traditional""" 4
  433. .el .IP "\f(CW\-\-traditional\fR" 4
  434. .IX Item "--traditional"
  435. .PD
  436. The \fB\-T\fR option causes \f(CW\*(C`gprof\*(C'\fR to print its output in
  437. \&\*(L"traditional\*(R" \s-1BSD\s0 style.
  438. .ie n .IP """\-w \fIwidth\fP""" 4
  439. .el .IP "\f(CW\-w \f(CIwidth\f(CW\fR" 4
  440. .IX Item "-w width"
  441. .PD 0
  442. .ie n .IP """\-\-width=\fIwidth\fP""" 4
  443. .el .IP "\f(CW\-\-width=\f(CIwidth\f(CW\fR" 4
  444. .IX Item "--width=width"
  445. .PD
  446. Sets width of output lines to \fIwidth\fR.
  447. Currently only used when printing the function index at the bottom
  448. of the call graph.
  449. .ie n .IP """\-x""" 4
  450. .el .IP "\f(CW\-x\fR" 4
  451. .IX Item "-x"
  452. .PD 0
  453. .ie n .IP """\-\-all\-lines""" 4
  454. .el .IP "\f(CW\-\-all\-lines\fR" 4
  455. .IX Item "--all-lines"
  456. .PD
  457. This option affects annotated source output only.
  458. By default, only the lines at the beginning of a basic-block
  459. are annotated. If this option is specified, every line in
  460. a basic-block is annotated by repeating the annotation for the
  461. first line. This behavior is similar to \f(CW\*(C`tcov\*(C'\fR's \fB\-a\fR.
  462. .ie n .IP """\-\-demangle[=\fIstyle\fP]""" 4
  463. .el .IP "\f(CW\-\-demangle[=\f(CIstyle\f(CW]\fR" 4
  464. .IX Item "--demangle[=style]"
  465. .PD 0
  466. .ie n .IP """\-\-no\-demangle""" 4
  467. .el .IP "\f(CW\-\-no\-demangle\fR" 4
  468. .IX Item "--no-demangle"
  469. .PD
  470. These options control whether \*(C+ symbol names should be demangled when
  471. printing output. The default is to demangle symbols. The
  472. \&\f(CW\*(C`\-\-no\-demangle\*(C'\fR option may be used to turn off demangling. Different
  473. compilers have different mangling styles. The optional demangling style
  474. argument can be used to choose an appropriate demangling style for your
  475. compiler.
  476. .SS "Analysis Options"
  477. .IX Subsection "Analysis Options"
  478. .ie n .IP """\-a""" 4
  479. .el .IP "\f(CW\-a\fR" 4
  480. .IX Item "-a"
  481. .PD 0
  482. .ie n .IP """\-\-no\-static""" 4
  483. .el .IP "\f(CW\-\-no\-static\fR" 4
  484. .IX Item "--no-static"
  485. .PD
  486. The \fB\-a\fR option causes \f(CW\*(C`gprof\*(C'\fR to suppress the printing of
  487. statically declared (private) functions. (These are functions whose
  488. names are not listed as global, and which are not visible outside the
  489. file/function/block where they were defined.) Time spent in these
  490. functions, calls to/from them, etc., will all be attributed to the
  491. function that was loaded directly before it in the executable file.
  492. This option affects both the flat profile and the call graph.
  493. .ie n .IP """\-c""" 4
  494. .el .IP "\f(CW\-c\fR" 4
  495. .IX Item "-c"
  496. .PD 0
  497. .ie n .IP """\-\-static\-call\-graph""" 4
  498. .el .IP "\f(CW\-\-static\-call\-graph\fR" 4
  499. .IX Item "--static-call-graph"
  500. .PD
  501. The \fB\-c\fR option causes the call graph of the program to be
  502. augmented by a heuristic which examines the text space of the object
  503. file and identifies function calls in the binary machine code.
  504. Since normal call graph records are only generated when functions are
  505. entered, this option identifies children that could have been called,
  506. but never were. Calls to functions that were not compiled with
  507. profiling enabled are also identified, but only if symbol table
  508. entries are present for them.
  509. Calls to dynamic library routines are typically \fInot\fR found
  510. by this option.
  511. Parents or children identified via this heuristic
  512. are indicated in the call graph with call counts of \fB0\fR.
  513. .ie n .IP """\-D""" 4
  514. .el .IP "\f(CW\-D\fR" 4
  515. .IX Item "-D"
  516. .PD 0
  517. .ie n .IP """\-\-ignore\-non\-functions""" 4
  518. .el .IP "\f(CW\-\-ignore\-non\-functions\fR" 4
  519. .IX Item "--ignore-non-functions"
  520. .PD
  521. The \fB\-D\fR option causes \f(CW\*(C`gprof\*(C'\fR to ignore symbols which
  522. are not known to be functions. This option will give more accurate
  523. profile data on systems where it is supported (Solaris and \s-1HPUX\s0 for
  524. example).
  525. .ie n .IP """\-k \fIfrom\fP/\fIto\fP""" 4
  526. .el .IP "\f(CW\-k \f(CIfrom\f(CW/\f(CIto\f(CW\fR" 4
  527. .IX Item "-k from/to"
  528. The \fB\-k\fR option allows you to delete from the call graph any arcs from
  529. symbols matching symspec \fIfrom\fR to those matching symspec \fIto\fR.
  530. .ie n .IP """\-l""" 4
  531. .el .IP "\f(CW\-l\fR" 4
  532. .IX Item "-l"
  533. .PD 0
  534. .ie n .IP """\-\-line""" 4
  535. .el .IP "\f(CW\-\-line\fR" 4
  536. .IX Item "--line"
  537. .PD
  538. The \fB\-l\fR option enables line-by-line profiling, which causes
  539. histogram hits to be charged to individual source code lines,
  540. instead of functions. This feature only works with programs compiled
  541. by older versions of the \f(CW\*(C`gcc\*(C'\fR compiler. Newer versions of
  542. \&\f(CW\*(C`gcc\*(C'\fR are designed to work with the \f(CW\*(C`gcov\*(C'\fR tool instead.
  543. .Sp
  544. If the program was compiled with basic-block counting enabled,
  545. this option will also identify how many times each line of
  546. code was executed.
  547. While line-by-line profiling can help isolate where in a large function
  548. a program is spending its time, it also significantly increases
  549. the running time of \f(CW\*(C`gprof\*(C'\fR, and magnifies statistical
  550. inaccuracies.
  551. .ie n .IP """\-\-inline\-file\-names""" 4
  552. .el .IP "\f(CW\-\-inline\-file\-names\fR" 4
  553. .IX Item "--inline-file-names"
  554. This option causes \f(CW\*(C`gprof\*(C'\fR to print the source file after each
  555. symbol in both the flat profile and the call graph. The full path to the
  556. file is printed if used with the \fB\-L\fR option.
  557. .ie n .IP """\-m \fInum\fP""" 4
  558. .el .IP "\f(CW\-m \f(CInum\f(CW\fR" 4
  559. .IX Item "-m num"
  560. .PD 0
  561. .ie n .IP """\-\-min\-count=\fInum\fP""" 4
  562. .el .IP "\f(CW\-\-min\-count=\f(CInum\f(CW\fR" 4
  563. .IX Item "--min-count=num"
  564. .PD
  565. This option affects execution count output only.
  566. Symbols that are executed less than \fInum\fR times are suppressed.
  567. .ie n .IP """\-n\fIsymspec\fP""" 4
  568. .el .IP "\f(CW\-n\f(CIsymspec\f(CW\fR" 4
  569. .IX Item "-nsymspec"
  570. .PD 0
  571. .ie n .IP """\-\-time=\fIsymspec\fP""" 4
  572. .el .IP "\f(CW\-\-time=\f(CIsymspec\f(CW\fR" 4
  573. .IX Item "--time=symspec"
  574. .PD
  575. The \fB\-n\fR option causes \f(CW\*(C`gprof\*(C'\fR, in its call graph analysis,
  576. to only propagate times for symbols matching \fIsymspec\fR.
  577. .ie n .IP """\-N\fIsymspec\fP""" 4
  578. .el .IP "\f(CW\-N\f(CIsymspec\f(CW\fR" 4
  579. .IX Item "-Nsymspec"
  580. .PD 0
  581. .ie n .IP """\-\-no\-time=\fIsymspec\fP""" 4
  582. .el .IP "\f(CW\-\-no\-time=\f(CIsymspec\f(CW\fR" 4
  583. .IX Item "--no-time=symspec"
  584. .PD
  585. The \fB\-n\fR option causes \f(CW\*(C`gprof\*(C'\fR, in its call graph analysis,
  586. not to propagate times for symbols matching \fIsymspec\fR.
  587. .ie n .IP """\-S\fIfilename\fP""" 4
  588. .el .IP "\f(CW\-S\f(CIfilename\f(CW\fR" 4
  589. .IX Item "-Sfilename"
  590. .PD 0
  591. .ie n .IP """\-\-external\-symbol\-table=\fIfilename\fP""" 4
  592. .el .IP "\f(CW\-\-external\-symbol\-table=\f(CIfilename\f(CW\fR" 4
  593. .IX Item "--external-symbol-table=filename"
  594. .PD
  595. The \fB\-S\fR option causes \f(CW\*(C`gprof\*(C'\fR to read an external symbol table
  596. file, such as \fI/proc/kallsyms\fR, rather than read the symbol table
  597. from the given object file (the default is \f(CW\*(C`a.out\*(C'\fR). This is useful
  598. for profiling kernel modules.
  599. .ie n .IP """\-z""" 4
  600. .el .IP "\f(CW\-z\fR" 4
  601. .IX Item "-z"
  602. .PD 0
  603. .ie n .IP """\-\-display\-unused\-functions""" 4
  604. .el .IP "\f(CW\-\-display\-unused\-functions\fR" 4
  605. .IX Item "--display-unused-functions"
  606. .PD
  607. If you give the \fB\-z\fR option, \f(CW\*(C`gprof\*(C'\fR will mention all
  608. functions in the flat profile, even those that were never called, and
  609. that had no time spent in them. This is useful in conjunction with the
  610. \&\fB\-c\fR option for discovering which routines were never called.
  611. .SS "Miscellaneous Options"
  612. .IX Subsection "Miscellaneous Options"
  613. .ie n .IP """\-d[\fInum\fP]""" 4
  614. .el .IP "\f(CW\-d[\f(CInum\f(CW]\fR" 4
  615. .IX Item "-d[num]"
  616. .PD 0
  617. .ie n .IP """\-\-debug[=\fInum\fP]""" 4
  618. .el .IP "\f(CW\-\-debug[=\f(CInum\f(CW]\fR" 4
  619. .IX Item "--debug[=num]"
  620. .PD
  621. The \fB\-d\fR \fInum\fR option specifies debugging options.
  622. If \fInum\fR is not specified, enable all debugging.
  623. .ie n .IP """\-h""" 4
  624. .el .IP "\f(CW\-h\fR" 4
  625. .IX Item "-h"
  626. .PD 0
  627. .ie n .IP """\-\-help""" 4
  628. .el .IP "\f(CW\-\-help\fR" 4
  629. .IX Item "--help"
  630. .PD
  631. The \fB\-h\fR option prints command line usage.
  632. .ie n .IP """\-O\fIname\fP""" 4
  633. .el .IP "\f(CW\-O\f(CIname\f(CW\fR" 4
  634. .IX Item "-Oname"
  635. .PD 0
  636. .ie n .IP """\-\-file\-format=\fIname\fP""" 4
  637. .el .IP "\f(CW\-\-file\-format=\f(CIname\f(CW\fR" 4
  638. .IX Item "--file-format=name"
  639. .PD
  640. Selects the format of the profile data files. Recognized formats are
  641. \&\fBauto\fR (the default), \fBbsd\fR, \fB4.4bsd\fR, \fBmagic\fR, and
  642. \&\fBprof\fR (not yet supported).
  643. .ie n .IP """\-s""" 4
  644. .el .IP "\f(CW\-s\fR" 4
  645. .IX Item "-s"
  646. .PD 0
  647. .ie n .IP """\-\-sum""" 4
  648. .el .IP "\f(CW\-\-sum\fR" 4
  649. .IX Item "--sum"
  650. .PD
  651. The \fB\-s\fR option causes \f(CW\*(C`gprof\*(C'\fR to summarize the information
  652. in the profile data files it read in, and write out a profile data
  653. file called \fIgmon.sum\fR, which contains all the information from
  654. the profile data files that \f(CW\*(C`gprof\*(C'\fR read in. The file \fIgmon.sum\fR
  655. may be one of the specified input files; the effect of this is to
  656. merge the data in the other input files into \fIgmon.sum\fR.
  657. .Sp
  658. Eventually you can run \f(CW\*(C`gprof\*(C'\fR again without \fB\-s\fR to analyze the
  659. cumulative data in the file \fIgmon.sum\fR.
  660. .ie n .IP """\-v""" 4
  661. .el .IP "\f(CW\-v\fR" 4
  662. .IX Item "-v"
  663. .PD 0
  664. .ie n .IP """\-\-version""" 4
  665. .el .IP "\f(CW\-\-version\fR" 4
  666. .IX Item "--version"
  667. .PD
  668. The \fB\-v\fR flag causes \f(CW\*(C`gprof\*(C'\fR to print the current version
  669. number, and then exit.
  670. .SS "Deprecated Options"
  671. .IX Subsection "Deprecated Options"
  672. These options have been replaced with newer versions that use symspecs.
  673. .ie n .IP """\-e \fIfunction_name\fP""" 4
  674. .el .IP "\f(CW\-e \f(CIfunction_name\f(CW\fR" 4
  675. .IX Item "-e function_name"
  676. The \fB\-e\fR \fIfunction\fR option tells \f(CW\*(C`gprof\*(C'\fR to not print
  677. information about the function \fIfunction_name\fR (and its
  678. children...) in the call graph. The function will still be listed
  679. as a child of any functions that call it, but its index number will be
  680. shown as \fB[not printed]\fR. More than one \fB\-e\fR option may be
  681. given; only one \fIfunction_name\fR may be indicated with each \fB\-e\fR
  682. option.
  683. .ie n .IP """\-E \fIfunction_name\fP""" 4
  684. .el .IP "\f(CW\-E \f(CIfunction_name\f(CW\fR" 4
  685. .IX Item "-E function_name"
  686. The \f(CW\*(C`\-E \f(CIfunction\f(CW\*(C'\fR option works like the \f(CW\*(C`\-e\*(C'\fR option, but
  687. time spent in the function (and children who were not called from
  688. anywhere else), will not be used to compute the percentages-of-time for
  689. the call graph. More than one \fB\-E\fR option may be given; only one
  690. \&\fIfunction_name\fR may be indicated with each \fB\-E\fR option.
  691. .ie n .IP """\-f \fIfunction_name\fP""" 4
  692. .el .IP "\f(CW\-f \f(CIfunction_name\f(CW\fR" 4
  693. .IX Item "-f function_name"
  694. The \fB\-f\fR \fIfunction\fR option causes \f(CW\*(C`gprof\*(C'\fR to limit the
  695. call graph to the function \fIfunction_name\fR and its children (and
  696. their children...). More than one \fB\-f\fR option may be given;
  697. only one \fIfunction_name\fR may be indicated with each \fB\-f\fR
  698. option.
  699. .ie n .IP """\-F \fIfunction_name\fP""" 4
  700. .el .IP "\f(CW\-F \f(CIfunction_name\f(CW\fR" 4
  701. .IX Item "-F function_name"
  702. The \fB\-F\fR \fIfunction\fR option works like the \f(CW\*(C`\-f\*(C'\fR option, but
  703. only time spent in the function and its children (and their
  704. children...) will be used to determine total-time and
  705. percentages-of-time for the call graph. More than one \fB\-F\fR option
  706. may be given; only one \fIfunction_name\fR may be indicated with each
  707. \&\fB\-F\fR option. The \fB\-F\fR option overrides the \fB\-E\fR option.
  708. .SH "FILES"
  709. .IX Header "FILES"
  710. .ie n .IP """\fIa.out\fP""" 4
  711. .el .IP "\f(CW\f(CIa.out\f(CW\fR" 4
  712. .IX Item "a.out"
  713. the namelist and text space.
  714. .ie n .IP """\fIgmon.out\fP""" 4
  715. .el .IP "\f(CW\f(CIgmon.out\f(CW\fR" 4
  716. .IX Item "gmon.out"
  717. dynamic call graph and profile.
  718. .ie n .IP """\fIgmon.sum\fP""" 4
  719. .el .IP "\f(CW\f(CIgmon.sum\f(CW\fR" 4
  720. .IX Item "gmon.sum"
  721. summarized dynamic call graph and profile.
  722. .SH "BUGS"
  723. .IX Header "BUGS"
  724. The granularity of the sampling is shown, but remains
  725. statistical at best.
  726. We assume that the time for each execution of a function
  727. can be expressed by the total time for the function divided
  728. by the number of times the function is called.
  729. Thus the time propagated along the call graph arcs to the function's
  730. parents is directly proportional to the number of times that
  731. arc is traversed.
  732. .PP
  733. Parents that are not themselves profiled will have the time of
  734. their profiled children propagated to them, but they will appear
  735. to be spontaneously invoked in the call graph listing, and will
  736. not have their time propagated further.
  737. Similarly, signal catchers, even though profiled, will appear
  738. to be spontaneous (although for more obscure reasons).
  739. Any profiled children of signal catchers should have their times
  740. propagated properly, unless the signal catcher was invoked during
  741. the execution of the profiling routine, in which case all is lost.
  742. .PP
  743. The profiled program must call \f(CW\*(C`exit\*(C'\fR(2)
  744. or return normally for the profiling information to be saved
  745. in the \fIgmon.out\fR file.
  746. .SH "SEE ALSO"
  747. .IX Header "SEE ALSO"
  748. \&\fImonitor\fR\|(3), \fIprofil\fR\|(2), \fIcc\fR\|(1), \fIprof\fR\|(1), and the Info entry for \fIgprof\fR.
  749. .PP
  750. \&\*(L"An Execution Profiler for Modular Programs\*(R",
  751. by S. Graham, P. Kessler, M. McKusick;
  752. Software \- Practice and Experience,
  753. Vol. 13, pp. 671\-685, 1983.
  754. .PP
  755. \&\*(L"gprof: A Call Graph Execution Profiler\*(R",
  756. by S. Graham, P. Kessler, M. McKusick;
  757. Proceedings of the \s-1SIGPLAN\s0 '82 Symposium on Compiler Construction,
  758. \&\s-1SIGPLAN\s0 Notices, Vol. 17, No 6, pp. 120\-126, June 1982.
  759. .SH "COPYRIGHT"
  760. .IX Header "COPYRIGHT"
  761. Copyright (c) 1988\-2021 Free Software Foundation, Inc.
  762. .PP
  763. Permission is granted to copy, distribute and/or modify this document
  764. under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
  765. or any later version published by the Free Software Foundation;
  766. with no Invariant Sections, with no Front-Cover Texts, and with no
  767. Back-Cover Texts. A copy of the license is included in the
  768. section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".