neingeist
/
arduinisten
Archived
1
0
Fork 0
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

85 lines
3.4 KiB
HTML

<html lang="en">
<head>
<title>How do I? - GNU gprof</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU gprof">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Inaccuracy.html#Inaccuracy" title="Inaccuracy">
<link rel="next" href="Incompatibilities.html#Incompatibilities" title="Incompatibilities">
<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, 92, 97, 98, 99, 2000, 2001, 2003, 2007 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.1
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''.
man end-->
<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; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="How-do-I_003f"></a>Next:&nbsp;<a rel="next" accesskey="n" href="Incompatibilities.html#Incompatibilities">Incompatibilities</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Inaccuracy.html#Inaccuracy">Inaccuracy</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr><br>
</div>
<h2 class="chapter">7 Answers to Common Questions</h2>
<dl>
<dt>How can I get more exact information about hot spots in my program?<dd>
Looking at the per-line call counts only tells part of the story.
Because <code>gprof</code> can only report call times and counts by function,
the best way to get finer-grained information on where the program
is spending its time is to re-factor large functions into sequences
of calls to smaller ones. Beware however that this can introduce
artificial hot spots since compiling with <span class="samp">-pg</span> adds a significant
overhead to function calls. An alternative solution is to use a
non-intrusive profiler, e.g. oprofile.
<br><dt>How do I find which lines in my program were executed the most times?<dd>
Use the <code>gcov</code> program.
<br><dt>How do I find which lines in my program called a particular function?<dd>
Use <span class="samp">gprof -l</span> and lookup the function in the call graph.
The callers will be broken down by function and line number.
<br><dt>How do I analyze a program that runs for less than a second?<dd>
Try using a shell script like this one:
<pre class="example"> for i in `seq 1 100`; do
fastprog
mv gmon.out gmon.out.$i
done
gprof -s fastprog gmon.out.*
gprof fastprog gmon.sum
</pre>
<p>If your program is completely deterministic, all the call counts
will be simple multiples of 100 (i.e., a function called once in
each run will appear with a call count of 100).
</dl>
</body></html>