gprof Observations

Bhattacharya, Soubhik soubhik_bhattacharya@mentorg.com
Thu Jul 3 12:28:00 GMT 2003


hi folks!

i wrote a small program and played around with `gprof' for sometime. i 
want to share my observations with you. corrections, criticism, and 
suggestions (to workaround the limitations of gprof) are welcome.

I've attached a tar gzipped version of the directory containing sources 
of the test programs, profiles generated by `gprof' (flat and 
call-graph) and a README, containing the details of the experimentation 
and my observations.

What follows is a summary of my observations :

1. if a function `foo()' is not compiled with -pg then gprof fails to 
determine the callers of and no. of calls to `foo()'. however, if 
`foo()' runs long enuff then it reliably estimates its self-time.

2. using -pg during linking ensures that the program is linked with a 
special gprof specific start file. this is the minimum requirement for 
gprof to be able to generate some useful information (a flat profile).

3. gprof fails to gather profiling info (self-time, no. of calls, 
calling functions) of a function residing in a shared object. any 
suggestion? i searched the net to find a couple of mails on a similar 
topic (http://mail.gnu.org/archive/html/bug-gnu-utils/2001-07/msg00284.html
http://sources.redhat.com/ml/binutils/2003-03/msg00208.html), which, 
sadly, went unanswered.

if obs 3. is correct, it shud be considered a serious limitation, 
restricting gprof's usefulness in modern software engineering.

cheers!
soubhik.




-- 
-0-1-2-3-4-5-6-7-8-9-0-1-2-3-4-5-6-7
Soubhik Bhattacharya
Associate Member Technical Staff
Mentor Graphics
Hyderabad, India.
-0-1-2-3-4-5-6-7-8-9-0-1-2-3-4-5-6-7



-------------- next part --------------
A non-text attachment was scrubbed...
Name: gproftest.tar.gz
Type: application/x-gzip
Size: 10741 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20030703/c8fdb3a9/attachment.bin>


More information about the Binutils mailing list