You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
12 KiB
HTML

<html lang="en">
<head>
<title>Output Options - GNU gprof</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU gprof">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Invoking.html#Invoking" title="Invoking">
<link rel="next" href="Analysis-Options.html#Analysis-Options" title="Analysis Options">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the gprof profiler of the GNU system.
Copyright (C) 1988-2015 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Output-Options"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Analysis-Options.html#Analysis-Options">Analysis Options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Invoking.html#Invoking">Invoking</a>
<hr>
</div>
<h3 class="section">4.1 Output Options</h3>
<!-- man begin OPTIONS -->
<p>These options specify which of several output formats
<code>gprof</code> should produce.
<p>Many of these options take an optional <dfn>symspec</dfn> to specify
functions to be included or excluded. These options can be
specified multiple times, with different symspecs, to include
or exclude sets of symbols. See <a href="Symspecs.html#Symspecs">Symspecs</a>.
<p>Specifying any of these options overrides the default (&lsquo;<samp><span class="samp">-p -q</span></samp>&rsquo;),
which prints a flat profile and call graph analysis
for all functions.
<dl>
<dt><code>-A[</code><var>symspec</var><code>]</code><dt><code>--annotated-source[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-A</span></samp>&rsquo; option causes <code>gprof</code> to print annotated source code.
If <var>symspec</var> is specified, print output only for matching symbols.
See <a href="Annotated-Source.html#Annotated-Source">The Annotated Source Listing</a>.
<br><dt><code>-b</code><dt><code>--brief</code><dd>If the &lsquo;<samp><span class="samp">-b</span></samp>&rsquo; option is given, <code>gprof</code> doesn't print the
verbose blurbs that try to explain the meaning of all of the fields in
the tables. This is useful if you intend to print out the output, or
are tired of seeing the blurbs.
<br><dt><code>-C[</code><var>symspec</var><code>]</code><dt><code>--exec-counts[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-C</span></samp>&rsquo; option causes <code>gprof</code> to
print a tally of functions and the number of times each was called.
If <var>symspec</var> is specified, print tally only for matching symbols.
<p>If the profile data file contains basic-block count records, specifying
the &lsquo;<samp><span class="samp">-l</span></samp>&rsquo; option, along with &lsquo;<samp><span class="samp">-C</span></samp>&rsquo;, will cause basic-block
execution counts to be tallied and displayed.
<br><dt><code>-i</code><dt><code>--file-info</code><dd>The &lsquo;<samp><span class="samp">-i</span></samp>&rsquo; option causes <code>gprof</code> to display summary information
about the profile data file(s) and then exit. The number of histogram,
call graph, and basic-block count records is displayed.
<br><dt><code>-I </code><var>dirs</var><dt><code>--directory-path=</code><var>dirs</var><dd>The &lsquo;<samp><span class="samp">-I</span></samp>&rsquo; option specifies a list of search directories in
which to find source files. Environment variable <var>GPROF_PATH</var>
can also be used to convey this information.
Used mostly for annotated source output.
<br><dt><code>-J[</code><var>symspec</var><code>]</code><dt><code>--no-annotated-source[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-J</span></samp>&rsquo; option causes <code>gprof</code> not to
print annotated source code.
If <var>symspec</var> is specified, <code>gprof</code> prints annotated source,
but excludes matching symbols.
<br><dt><code>-L</code><dt><code>--print-path</code><dd>Normally, source filenames are printed with the path
component suppressed. The &lsquo;<samp><span class="samp">-L</span></samp>&rsquo; option causes <code>gprof</code>
to print the full pathname of
source filenames, which is determined
from symbolic debugging information in the image file
and is relative to the directory in which the compiler
was invoked.
<br><dt><code>-p[</code><var>symspec</var><code>]</code><dt><code>--flat-profile[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-p</span></samp>&rsquo; option causes <code>gprof</code> to print a flat profile.
If <var>symspec</var> is specified, print flat profile only for matching symbols.
See <a href="Flat-Profile.html#Flat-Profile">The Flat Profile</a>.
<br><dt><code>-P[</code><var>symspec</var><code>]</code><dt><code>--no-flat-profile[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-P</span></samp>&rsquo; option causes <code>gprof</code> to suppress printing a flat profile.
If <var>symspec</var> is specified, <code>gprof</code> prints a flat profile,
but excludes matching symbols.
<br><dt><code>-q[</code><var>symspec</var><code>]</code><dt><code>--graph[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-q</span></samp>&rsquo; option causes <code>gprof</code> to print the call graph analysis.
If <var>symspec</var> is specified, print call graph only for matching symbols
and their children.
See <a href="Call-Graph.html#Call-Graph">The Call Graph</a>.
<br><dt><code>-Q[</code><var>symspec</var><code>]</code><dt><code>--no-graph[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-Q</span></samp>&rsquo; option causes <code>gprof</code> to suppress printing the
call graph.
If <var>symspec</var> is specified, <code>gprof</code> prints a call graph,
but excludes matching symbols.
<br><dt><code>-t</code><dt><code>--table-length=</code><var>num</var><dd>The &lsquo;<samp><span class="samp">-t</span></samp>&rsquo; option causes the <var>num</var> most active source lines in
each source file to be listed when source annotation is enabled. The
default is 10.
<br><dt><code>-y</code><dt><code>--separate-files</code><dd>This option affects annotated source output only.
Normally, <code>gprof</code> prints annotated source files
to standard-output. If this option is specified,
annotated source for a file named <samp><span class="file">path/</span><var>filename</var></samp>
is generated in the file <samp><var>filename</var><span class="file">-ann</span></samp>. If the underlying
file system would truncate <samp><var>filename</var><span class="file">-ann</span></samp> so that it
overwrites the original <samp><var>filename</var></samp>, <code>gprof</code> generates
annotated source in the file <samp><var>filename</var><span class="file">.ann</span></samp> instead (if the
original file name has an extension, that extension is <em>replaced</em>
with <samp><span class="file">.ann</span></samp>).
<br><dt><code>-Z[</code><var>symspec</var><code>]</code><dt><code>--no-exec-counts[=</code><var>symspec</var><code>]</code><dd>The &lsquo;<samp><span class="samp">-Z</span></samp>&rsquo; option causes <code>gprof</code> not to
print a tally of functions and the number of times each was called.
If <var>symspec</var> is specified, print tally, but exclude matching symbols.
<br><dt><code>-r</code><dt><code>--function-ordering</code><dd>The &lsquo;<samp><span class="samp">--function-ordering</span></samp>&rsquo; option causes <code>gprof</code> to print a
suggested function ordering for the program based on profiling data.
This option suggests an ordering which may improve paging, tlb and
cache behavior for the program on systems which support arbitrary
ordering of functions in an executable.
<p>The exact details of how to force the linker to place functions
in a particular order is system dependent and out of the scope of this
manual.
<br><dt><code>-R </code><var>map_file</var><dt><code>--file-ordering </code><var>map_file</var><dd>The &lsquo;<samp><span class="samp">--file-ordering</span></samp>&rsquo; option causes <code>gprof</code> to print a
suggested .o link line ordering for the program based on profiling data.
This option suggests an ordering which may improve paging, tlb and
cache behavior for the program on systems which do not support arbitrary
ordering of functions in an executable.
<p>Use of the &lsquo;<samp><span class="samp">-a</span></samp>&rsquo; argument is highly recommended with this option.
<p>The <var>map_file</var> argument is a pathname to a file which provides
function name to object file mappings. The format of the file is similar to
the output of the program <code>nm</code>.
<pre class="smallexample"> c-parse.o:00000000 T yyparse
c-parse.o:00000004 C yyerrflag
c-lang.o:00000000 T maybe_objc_method_name
c-lang.o:00000000 T print_lang_statistics
c-lang.o:00000000 T recognize_objc_keyword
c-decl.o:00000000 T print_lang_identifier
c-decl.o:00000000 T print_lang_type
...
</pre>
<p>To create a <var>map_file</var> with <span class="sc">gnu</span> <code>nm</code>, type a command like
<kbd>nm --extern-only --defined-only -v --print-file-name program-name</kbd>.
<br><dt><code>-T</code><dt><code>--traditional</code><dd>The &lsquo;<samp><span class="samp">-T</span></samp>&rsquo; option causes <code>gprof</code> to print its output in
&ldquo;traditional&rdquo; BSD style.
<br><dt><code>-w </code><var>width</var><dt><code>--width=</code><var>width</var><dd>Sets width of output lines to <var>width</var>.
Currently only used when printing the function index at the bottom
of the call graph.
<br><dt><code>-x</code><dt><code>--all-lines</code><dd>This option affects annotated source output only.
By default, only the lines at the beginning of a basic-block
are annotated. If this option is specified, every line in
a basic-block is annotated by repeating the annotation for the
first line. This behavior is similar to <code>tcov</code>'s &lsquo;<samp><span class="samp">-a</span></samp>&rsquo;.
<br><dt><code>--demangle[=</code><var>style</var><code>]</code><dt><code>--no-demangle</code><dd>These options control whether C++ symbol names should be demangled when
printing output. The default is to demangle symbols. The
<code>--no-demangle</code> option may be used to turn off demangling. Different
compilers have different mangling styles. The optional demangling style
argument can be used to choose an appropriate demangling style for your
compiler.
</dl>
</body></html>