public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Profiling & nested functions?
@ 2005-02-16  4:44 Laurent GUERBY
  2005-02-16  4:48 ` Daniel Jacobowitz
  2005-02-16 12:56 ` Nick Clifton
  0 siblings, 2 replies; 4+ messages in thread
From: Laurent GUERBY @ 2005-02-16  4:44 UTC (permalink / raw)
  To: binutils; +Cc: drow, laurent

Hi,

I searched the binutils mailing list and I find only an email from 2001 
by Daniel Jacobowitz on the subject without follow-ups:

http://sourceware.org/ml/binutils/2001-11/msg00408.html

And couldn't find "nested" keyword in bugzilla.

A GCC developper said that the appropriate calls were generated so this
was probably a gprof issue.

Should I open a bugzilla?

Thanks in advance for your help,

Laurent

-------- Forwarded Message --------
From: Laurent GUERBY <laurent@guerby.net>
To: gcc@gcc.gnu.org
Subject: Profiling & nested functions
Date: Mon, 14 Feb 2005 21:51:47 +0100
Hi,

Is GCC + gprof supposed to handle nested functions?
It looks like they are not properly reported.
The original problem was on Ada code with nested
functions. This is with HEAD and GNU gprof 2.15.91.0.2
on a SuSE 9.2 system.

Thanks in advance,

Laurent

$ cat cn.c
#define N 10000000
static int sum=0;
void p1(void) {
  int i;
  for(i=1;i<=N;i++) sum+=(i+1)/i;
}
void p2(void) {
  int f2(int x) {
    return x;
  }
  int i;
  for(i=1;i<=2*N;i++) sum+=f2(i+1)/i;
}
void p3(void) {
  int i;
  for(i=1;i<=3*N;i++) sum+=(i+1)/i;
}

int main(void) {
  p1();
  p2();
  p3();
  return 0;
}
$ gcc -pg -g cn.c 
$ ./a.out
$ gprof ./a.out 
[...]
Flat profile:
  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name    
 49.49      8.70     8.70        1     8.70     8.70  p3
 34.13     14.70     6.00        1     6.00     6.00  p2
 16.38     17.58     2.88        1     2.88     2.88  p1
[...]
index % time    self  children    called     name
                                                 <spontaneous>
[1]    100.0    0.00   17.58                 main [1]
                8.70    0.00       1/1           p3 [2]
                6.00    0.00       1/1           p2 [3]
                2.88    0.00       1/1           p1 [4]
-----------------------------------------------
                8.70    0.00       1/1           main [1]
[2]     49.5    8.70    0.00       1         p3 [2]
-----------------------------------------------
                             20000000             p2 [3]
                6.00    0.00       1/1           main [1]
[3]     34.1    6.00    0.00       1+20000000 p2 [3]
                             20000000             p2 [3]
-----------------------------------------------
                2.88    0.00       1/1           main [1]
[4]     16.4    2.88    0.00       1         p1 [4]
-----------------------------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Profiling & nested functions?
  2005-02-16  4:44 Profiling & nested functions? Laurent GUERBY
@ 2005-02-16  4:48 ` Daniel Jacobowitz
  2005-02-16 12:56 ` Nick Clifton
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-02-16  4:48 UTC (permalink / raw)
  To: Laurent GUERBY; +Cc: binutils

On Tue, Feb 15, 2005 at 10:54:28PM +0100, Laurent GUERBY wrote:
> Hi,
> 
> I searched the binutils mailing list and I find only an email from 2001 
> by Daniel Jacobowitz on the subject without follow-ups:
> 
> http://sourceware.org/ml/binutils/2001-11/msg00408.html

That was a MIPS specific problem, so this isn't going to help you any.


-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Profiling & nested functions?
  2005-02-16  4:44 Profiling & nested functions? Laurent GUERBY
  2005-02-16  4:48 ` Daniel Jacobowitz
@ 2005-02-16 12:56 ` Nick Clifton
  2005-02-16 18:01   ` Laurent GUERBY
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2005-02-16 12:56 UTC (permalink / raw)
  To: Laurent GUERBY; +Cc: binutils, drow

Hi Laurent,

> A GCC developper said that the appropriate calls were generated so this
> was probably a gprof issue.
> 
> Should I open a bugzilla?

Yes please.  Including the test case would really help too.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Profiling & nested functions?
  2005-02-16 12:56 ` Nick Clifton
@ 2005-02-16 18:01   ` Laurent GUERBY
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent GUERBY @ 2005-02-16 18:01 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, drow

Done:

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

Thanks for your time,

Laurent

On Wed, 2005-02-16 at 12:04 +0000, Nick Clifton wrote:
> Hi Laurent,
> 
> > A GCC developper said that the appropriate calls were generated so this
> > was probably a gprof issue.
> > 
> > Should I open a bugzilla?
> 
> Yes please.  Including the test case would really help too.
> 
> Cheers
>    Nick
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-16 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-16  4:44 Profiling & nested functions? Laurent GUERBY
2005-02-16  4:48 ` Daniel Jacobowitz
2005-02-16 12:56 ` Nick Clifton
2005-02-16 18:01   ` Laurent GUERBY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).