F77 Internal Timing Measurement 
Author Message
 F77 Internal Timing Measurement

Hi,

I am interested in measuring the execution times of a F77 program internally.
This internal timing measurements may be for subroutines or functions or even
some parts in the main program itself. As of now, I am using unix 'timex'
command to measure the real, user and sys times for the whole program. Any
pointers where I can find information about the ways to measure the internal
execution times in a F77 program. I looked in several books available here,
but they don't have any information.

Sincerely,
Naren

      mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
      Narendra K., 1218 S. Main St., #201, Moscow, ID 83843. 208-882-4080
      Narendra K., BEL314, Univ. of Idaho, Moscow, ID 83844. 208-885-6699

      mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm



Tue, 19 Oct 1999 03:00:00 GMT  
 F77 Internal Timing Measurement

Hi Naren. Gene here. Timing routines are machine specific. To get
wallclock time (not CPU time) on HP, do a man on gettimeofday. I
dont know if it is accesible to fortran. If not, write a C routine
which uses gettimeofday, then call it from Fortran. If you cant
do this, post again or send me email.

Gene W.
--
-------------------------------------------------------------------
Gene Wagenbreth  Programming for Dollars
My opinions are mine, I think.
-------------------------------------------------------------------



Tue, 19 Oct 1999 03:00:00 GMT  
 F77 Internal Timing Measurement

Quote:

> Hi,

> I am interested in measuring the execution times of a F77 program internally.
> This internal timing measurements may be for subroutines or functions or even
> some parts in the main program itself. As of now, I am using unix 'timex'
> command to measure the real, user and sys times for the whole program. Any
> pointers where I can find information about the ways to measure the internal
> execution times in a F77 program. I looked in several books available here,
> but they don't have any information.

> Sincerely,
> Naren

--
Naren,

Here is what Gene Wagenbreth suggested I guess.  It works for me on an
HP machine.  Let me know it does the job for you.
C
C     Here is the FORTRAN part of it
C

      subroutine det_time(time_spent,sec,u_sec)
       implicit none
       integer time_spent
       integer sec(2), u_sec(2)
       integer extra_time, time_u

        extra_time = sec(2) - sec(1)
        extra_time = 1000000*extra_time

        time_u = u_sec(2) - u_sec(1)

        time_spent = time_u + extra_time

       return
      end

---------------------------------------------------------------

Here is a C routine that after compilation has to be linked
with the compiled fortran routines.

#include<sys/time.h>

void get_time(isec, iusec)
int *isec ;
int *iusec ;
{
 struct timeval tp ;
 struct timezone tzp ;

 gettimeofday(&tp, &tzp) ;
 *isec = tp.tv_sec ;
 *iusec = tp.tv_usec ;

 return ;

Quote:
}

---------------------------------------------------------------
C
C     Here is an example
C
      PROGRAM Time
       implicit none
        integer m, n
        parameter (m=10)
        parameter (n=10)
        real*8 a(m,n), b(m,n)
        integer i, j
        integer sec(2), u_sec(2)
        integer time_spent

         do i=1, n
          do j=1, m
           b(j,i) = 3.3d0
          enddo
         enddo

         do i=1, n
          do j=1, m
           a(j,i) = 1.7d0
          enddo
         enddo

C----------------------------------------------------------------------
C..      Call a subroutine 1000 times and time the thing
C----------------------------------------------------------------------
         call get_time(sec(1),u_sec(1))

         do i=1, 1000
          call addAB(n,m,a,b)
         enddo

         call get_time(sec(2),u_sec(2))
         call det_time(time_spent,sec,u_sec)

         print *, "Time Spent:", time_spent

       stop
      end
C***********************************************************************
C***********************************************************************

________________________________________________________________________

Center for Computer Aided Design        | Phone : 319-335-5725
ERF 229                                 | Fax   : 319-384-0542
The University of Iowa, Iowa-City       |
------------------------------------------------------------------------



Fri, 22 Oct 1999 03:00:00 GMT  
 F77 Internal Timing Measurement


Quote:


> > Hi,

> > I am interested in measuring the execution times of a F77 program
internally.

> > Sincerely,
> > Naren

> --

Dear Naren,  

On your system you may find some code profiling tools, such as pixie, prof
or gprof.  These tools can show you how often each line or subprogram is
executed, and for how long, etc.  Just the things for making turbocharged
programs! Seeing as you are on a UNIX system, do a 'man -k profil' to see
what tools are available, or ask your sysops.

Of course, if your system doesn't have these tools, you can embed calls to
your system's time routines and do it yourself, as other posters have
shown.

--Andrej

--
--Andrej

Dr Andrej Panjkov, Maths, La Trobe Uni, Melbourne Australia, 3083

Phone:  Work:  (03)94792595,    
WWW: http://guardian.maths.latrobe.edu.au

Public PGP key available from my web site.  Fingerprint follows:


            Key fingerprint = BB 8D CB 1B 72 82 FC C7  0F 21 6B 85 CB 71 22 18



Sun, 24 Oct 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. time measurement f77

2. MEASUREMENT OF EXECUTION TIME for F77

3. UTC time conversion to internal time

4. Time measurement with PB

5. Time measurement with PB

6. Format Time measurement

7. Time measurement between AO generation and digital input

8. looking for fast real-time measurement board

9. Time measurement between two different signal sources

10. Need help changing a measurement time limitation.

11. Waveform chart and timing measurements

12. How do I write out the time a measurement was taken

 

 
Powered by phpBB® Forum Software