Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Oct 1996 13:42:54 -0700 (PDT)
From:      "Steven G. Kargl" <sgk@troutmask.apl.washington.edu>
To:        freebsd-current@freebsd.org
Subject:   Is profiling code broken?
Message-ID:  <199610232042.NAA05182@troutmask.apl.washington.edu>

next in thread | raw e-mail | index | archive | help
In my battle to increase the speed of some of my computations, I
will compile the code with profiling enabled.  Today, to my 
surprise my code seems to be executing infinitely fast.  

This is on a -current machine that was last build on 9 Oct 96.
I'm in the process of doing a make world on freshly supped
sources.

For those who are programming language impaired, this is Fortran :-).

      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

      double precision function f(x)
      double precision x
      integer i
      do 3 i = 1, 100
         f = x / 2.d0
3     continue
      return
      end


kargl[264] f77 -o t -pg t.f
kargl[265] time t
       59.80 real         0.00 user        48.34 sys

kargl[266] gprof -l -b t gmon.out | more

granularity: each sample hit covers 4 byte(s) no time accumulated

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
  0.0       0.00     0.00  1000000     0.00     0.00  _f_ [11]
  0.0       0.00     0.00        6     0.00     0.00  _sigaction [12]
  0.0       0.00     0.00        6     0.00     0.00  _signal [13]
  0.0       0.00     0.00        5     0.00     0.00  ___syscall [14]
  0.0       0.00     0.00        4     0.00     0.00  ___sseek [15]
  0.0       0.00     0.00        4     0.00     0.00  _ftell [16]
  0.0       0.00     0.00        4     0.00     0.00  _imalloc <cycle 1> [17]
  0.0       0.00     0.00        4     0.00     0.00  _ioctl [18]
  0.0       0.00     0.00        4     0.00     0.00  _isatty [19]
  0.0       0.00     0.00        4     0.00     0.00  _lseek [20]
  0.0       0.00     0.00        4     0.00     0.00  _sbrk [21]
  0.0       0.00     0.00        4     0.00     0.00  _tcgetattr [22]
  0.0       0.00     0.00        3     0.00     0.00  ___sflush [23]

There appears to be about 11 seconds missing from the time command
that should be accounted for by gprof.

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.

-- 
Steve



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