Re: gcov - time spent on each line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thomas,

On Tue, Sep 22, 2009 at 07:34:02AM -0700, Thomas Robitaille wrote:
> I'm trying to use gcov to figure out which lines a program is spending most
> of it's time calling. The default output is to show the number of calls for
> each line, but is there a way to instead output the time spent on each line?

There is (presently) no way to determine the time spent on each 
line with gcov (gcov even does not go below the granularity of basic blocks 
(http://en.wikipedia.org/wiki/Basic_block) which in typical programs
more often than not span more than one line). 

> If not, are there alternative tools that can be used to find this out?

Two alternatives: (1) disassemble your compiled output (objdump), use your
architecture's manual to assign weights to the assembly instruction
(e.g. "1" for increment operation, "4" for a jump operation, but this 
depends on architecture) and count the CPU cycles.
(2) actually measure timings by directly measuring CPU actions (possibly
depending on architecture, e.g. for example (disclaimer: speaking out 
of personal memory only - no implied endorsement!) a vendor based here 
in Germany for Nexus could be http://www.lauterbach.com/nexus.html, 
in the US a vendor could be http://www.bullseye.com/ for the
protocol see http://en.wikipedia.org/wiki/Nexus_(standard) )

Cheers,

-- 
Holger Blasum (SYSGO AG)

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux