Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unless your program has very few functions and hardly ever calls a system function or I/O, profilers that sample the program counter won't tell you much, as you're discovering. In fact, the well-known profiler <em>gprof</em> was created specifically to try to address the uselessness of self-time-only profiling (not that it succeeded).</p> <p>What actually works is something that samples the <em>call stack</em> (thereby finding out where the calls are coming from), on <em>wall-clock</em> time (thereby including I/O time), and report <em>by line or by instruction</em> (thereby pinpointing the function calls that you should investigate, not just the functions they live in).</p> <p>Furthermore, the statistic you should look for is <em>percent of time on stack</em>, not number of calls, not average inclusive function time. <em>Especially not "self time".</em> If a call instruction (or a non-call instruction) is on the stack 38% of the time, then if you could get rid of it, how much would you save? <strong>38%!</strong> Pretty simple, no?</p> <p>An example of such a profiler is <a href="http://www.rotateright.com/" rel="nofollow noreferrer">Zoom</a>.</p> <p>There are <a href="https://stackoverflow.com/questions/1777556/alternatives-to-gprof/1779343#1779343">more issues to be understood</a> on this subject.</p> <p>Added: @caf got me hunting for the <code>perf</code> info, and since you included the command-line argument <code>-g</code> it does collect stack samples. Then you can get a <a href="http://lwn.net/Articles/340010/" rel="nofollow noreferrer">call-tree</a> report. Then if you make sure you're sampling on wall-clock time (so you get wait time as well as cpu time) then you've got <em>almost</em> what you need.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload