------- Additional Comments From nickc at redhat dot com  2005-03-15 16:34 
-------
Hi Laurent,

  This is not a bug but rather a feature of gprof.  It considers nested
functions to be part of their parent function and by default it will include
their timing in their parent's total.  You can get to see the time spent in the
nested function if you really want to however - by using the "-l" switch to
gprof.  For example with the test program you supplied I get the following
results from "gprof -l -b ./a.out":

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 38.25      0.70     0.70                             p3 (profile.c:34 @8048537)
 36.61      1.37     0.67                             p2 (profile.c:25 @80484d1)
 13.11      1.61     0.24                             p1 (profile.c:10 @8048488)
  7.10      1.74     0.13                             f2 (profile.c:19 @8048518)
  1.09      1.76     0.02        1    20.00    20.00  p3 (profile.c:30 @8048523)
  1.09      1.78     0.02                             f2 (profile.c:20 @8048521)
  0.82      1.79     0.01                             p3 (profile.c:33 @804855c)
  0.82      1.81     0.01                             p3 (profile.c:35 @804856a)
  0.55      1.82     0.01                             p1 (profile.c:9 @80484ad)
  0.55      1.83     0.01                             p2 (profile.c:24 @8048500)
  0.00      1.83     0.00 20000001     0.00     0.00  p2 (profile.c:15 @80484bd)
  0.00      1.83     0.00        1     0.00     0.00  p1 (profile.c:7 @8048474)

[...]
 
Index by function name

   [4] f2 (profile.c:19 @ 8048518) [10] p1 (profile.c:9 @ 80484ad) [5] p3
(prole.c:30 @ 8048523)
   [6] f2 (profile.c:20 @ 8048521) [12] p2 (profile.c:15 @ 80484bd) [1] p3
(profile.c:34 @ 8048537)
  [13] p1 (profile.c:7 @ 8048474) [2] p2 (profile.c:25 @ 80484d1) [8] p3
(profile.c:33 @ 804855c)
   [3] p1 (profile.c:10 @ 8048488) [11] p2 (profile.c:24 @ 8048500) [9] p3
(profile.c:35 @ 804856a)

Cheers
  Nick


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://sources.redhat.com/bugzilla/show_bug.cgi?id=747

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to