blob: 058de551edd9ba7d03831bc4f7cbaf18c3a7e4df [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This file documents the gprof profiler of the GNU system.
Copyright (C) 1988, 1992, 1997, 1998, 1999, 2000, 2001, 2003,
2007, 2008, 2009 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".
-->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU gprof: Output Options</title>
<meta name="description" content="GNU gprof: Output Options">
<meta name="keywords" content="GNU gprof: Output Options">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Invoking.html#Invoking" rel="up" title="Invoking">
<link href="Analysis-Options.html#Analysis-Options" rel="next" title="Analysis Options">
<link href="Invoking.html#Invoking" rel="prev" title="Invoking">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Output-Options"></a>
<div class="header">
<p>
Next: <a href="Analysis-Options.html#Analysis-Options" accesskey="n" rel="next">Analysis Options</a>, Up: <a href="Invoking.html#Invoking" accesskey="u" rel="up">Invoking</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="Output-Options-1"></a>
<h3 class="section">4.1 Output Options</h3>
<p>These options specify which of several output formats
<code>gprof</code> should produce.
</p>
<p>Many of these options take an optional <em>symspec</em> 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>
<p>Specifying any of these options overrides the default (&lsquo;<samp>-p -q</samp>&rsquo;),
which prints a flat profile and call graph analysis
for all functions.
</p>
<dl compact="compact">
<dt><code>-A[<var>symspec</var>]</code></dt>
<dt><code>--annotated-source[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-A</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>.
</p>
</dd>
<dt><code>-b</code></dt>
<dt><code>--brief</code></dt>
<dd><p>If the &lsquo;<samp>-b</samp>&rsquo; option is given, <code>gprof</code> doesn&rsquo;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.
</p>
</dd>
<dt><code>-C[<var>symspec</var>]</code></dt>
<dt><code>--exec-counts[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-C</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>
<p>If the profile data file contains basic-block count records, specifying
the &lsquo;<samp>-l</samp>&rsquo; option, along with &lsquo;<samp>-C</samp>&rsquo;, will cause basic-block
execution counts to be tallied and displayed.
</p>
</dd>
<dt><code>-i</code></dt>
<dt><code>--file-info</code></dt>
<dd><p>The &lsquo;<samp>-i</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.
</p>
</dd>
<dt><code>-I <var>dirs</var></code></dt>
<dt><code>--directory-path=<var>dirs</var></code></dt>
<dd><p>The &lsquo;<samp>-I</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.
</p>
</dd>
<dt><code>-J[<var>symspec</var>]</code></dt>
<dt><code>--no-annotated-source[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-J</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.
</p>
</dd>
<dt><code>-L</code></dt>
<dt><code>--print-path</code></dt>
<dd><p>Normally, source filenames are printed with the path
component suppressed. The &lsquo;<samp>-L</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.
</p>
</dd>
<dt><code>-p[<var>symspec</var>]</code></dt>
<dt><code>--flat-profile[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-p</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>.
</p>
</dd>
<dt><code>-P[<var>symspec</var>]</code></dt>
<dt><code>--no-flat-profile[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-P</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.
</p>
</dd>
<dt><code>-q[<var>symspec</var>]</code></dt>
<dt><code>--graph[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-q</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>.
</p>
</dd>
<dt><code>-Q[<var>symspec</var>]</code></dt>
<dt><code>--no-graph[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-Q</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.
</p>
</dd>
<dt><code>-t</code></dt>
<dt><code>--table-length=<var>num</var></code></dt>
<dd><p>The &lsquo;<samp>-t</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.
</p>
</dd>
<dt><code>-y</code></dt>
<dt><code>--separate-files</code></dt>
<dd><p>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>path/<var>filename</var></samp>
is generated in the file <samp><var>filename</var>-ann</samp>. If the underlying
file system would truncate <samp><var>filename</var>-ann</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>.ann</samp> instead (if the
original file name has an extension, that extension is <em>replaced</em>
with <samp>.ann</samp>).
</p>
</dd>
<dt><code>-Z[<var>symspec</var>]</code></dt>
<dt><code>--no-exec-counts[=<var>symspec</var>]</code></dt>
<dd><p>The &lsquo;<samp>-Z</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.
</p>
</dd>
<dt><code>-r</code></dt>
<dt><code>--function-ordering</code></dt>
<dd><p>The &lsquo;<samp>--function-ordering</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>
<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.
</p>
</dd>
<dt><code>-R <var>map_file</var></code></dt>
<dt><code>--file-ordering <var>map_file</var></code></dt>
<dd><p>The &lsquo;<samp>--file-ordering</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>
<p>Use of the &lsquo;<samp>-a</samp>&rsquo; argument is highly recommended with this option.
</p>
<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>.
</p>
<div class="smallexample">
<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
&hellip;
</pre></div>
<p>To create a <var>map_file</var> with <small>GNU</small> <code>nm</code>, type a command like
<kbd>nm --extern-only --defined-only -v --print-file-name program-name</kbd>.
</p>
</dd>
<dt><code>-T</code></dt>
<dt><code>--traditional</code></dt>
<dd><p>The &lsquo;<samp>-T</samp>&rsquo; option causes <code>gprof</code> to print its output in
&ldquo;traditional&rdquo; BSD style.
</p>
</dd>
<dt><code>-w <var>width</var></code></dt>
<dt><code>--width=<var>width</var></code></dt>
<dd><p>Sets width of output lines to <var>width</var>.
Currently only used when printing the function index at the bottom
of the call graph.
</p>
</dd>
<dt><code>-x</code></dt>
<dt><code>--all-lines</code></dt>
<dd><p>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>&rsquo;s &lsquo;<samp>-a</samp>&rsquo;.
</p>
</dd>
<dt><code>--demangle[=<var>style</var>]</code></dt>
<dt><code>--no-demangle</code></dt>
<dd><p>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.
</p></dd>
</dl>
<hr>
<div class="header">
<p>
Next: <a href="Analysis-Options.html#Analysis-Options" accesskey="n" rel="next">Analysis Options</a>, Up: <a href="Invoking.html#Invoking" accesskey="u" rel="up">Invoking</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
</body>
</html>