Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Oct 1996 15:10:00 -0700 (PDT)
From:      "Steven G. Kargl" <sgk@troutmask.apl.washington.edu>
To:        terry@lambert.org (Terry Lambert)
Cc:        freebsd-current@freebsd.org
Subject:   Re: Is profiling code broken?
Message-ID:  <199610232210.PAA07504@troutmask.apl.washington.edu>
In-Reply-To: <199610232122.OAA10485@phaeton.artisoft.com> from Terry Lambert at "Oct 23, 96 02:22:19 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
According to Terry Lambert:
> >       program t
> >       implicit none
> >       double precision x, f
> >       integer i, j
> >       external f
> > 
> >       do 1 i =1, 1000
> >          do 2 j = 1, 1000
> >             x = f(dble(i))
> > 2        continue
> > 1     continue
> >       end
> 
> I would expect the second do loop to be removed by a decent optimizer;
> ij is not a dependent variable.  Maybe the back end changed to 2.7.2 or
> the default optimization flags have changed in the compilation script?

Okay, it was a simple example program.  On my code with 5k lines that
can take an hour or more to run, I still get no profiling information
other than the number of times a function (subroutine) has been called.

Also, in the profile output included in the original message, you'll
see that the f() function was call 1000000 time as expected.

[Terry's remaining analysis deleted]

> 
> > Additionally, I noticed that the profiled libraries built during a
> > make world use a -p flag instead of -pg.  Why? We do not currently
> > have prof(1) in the source tree.
> 
> g is debugging information; you don't need it for profiling?
> 

man gcc
...
       -pg    Generate  extra  code  to write profile information
              suitable for the analysis program gprof.
...

If you compile with -p alone, gcc (or ld) tries to link in /usr/lib/mrt0.o
which does not exist on my FreeBSD system.
-- 
Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610232210.PAA07504>