ETIME 4 g77/linux??? 
Author Message
 ETIME 4 g77/linux???

I was wondering, is there a way to implement this, or more simply, is
there an ETIME or TIME funcition for G77?

        PROGRAM MAIN
        REAL*4  TARRAY(2), ETIME
        REAL*4  AAA, BBB
        AAA = ETIME(TARRAY)
        BBB = ETIME(TARRAY)
        PRINT*,'CPUTIME: ', AAA - BBB
        END

-TIA

============================================================================
                        |       "...peace is a thing which a person
Dwight M. Evers         |           must be willing to fight for..."

        NDSU            |                       -Abe Lincoln
============================================================================



Mon, 21 Sep 1998 03:00:00 GMT  
 ETIME 4 g77/linux???

 Dwight> I was wondering, is there a way to implement this, or more simply, is
 Dwight> there an ETIME or TIME funcition for G77?

No.  Something like this will eventually be in the runtime.  You'll
have to work out config.h substitute.

/* Copyright (C) 1995 Free Software Foundation, Inc.
This file is part of GNU fortran libU77 library.

This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GNU Fortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with GNU Fortran; see the file COPYING.LIB.  If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if HAVE_UNISTD_H
#  include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/times.h>
#include <sys/param.h>
#include "f2c.h"

/* For dtime, etime we store the clock tick parameter (clk_tck) the
   first time either of them is invoked rather than each time.  This
   approach probably speeds up each invocation by avoiding a system
   call each time, but means that the overhead of the first call is
   different to all others. */
static long clk_tck = 0;

#ifdef KR_headers
doublereal etime_ (tarray)
     real tarray[2];
#else
doublereal etime_ (real tarray[2])
#endif
{
  struct tms buffer;

#ifdef _SC_CLK_TCK
  if (! clk_tck) clk_tck = sysconf(_SC_CLK_TCK);
#elif defined CLOCKS_PER_SECOND
  if (! clk_tck) clk_tck = CLOCKS_PER_SECOND;
#elif defined CLK_TCK
  if (! clk_tck) clk_tck = CLK_TCK;
#else
  #error Dont know clock tick length
#endif
  if (times(&buffer) < 0) return -1.0;
  tarray[0] = (float) buffer.tms_utime / (float)clk_tck;
  tarray[1] = (float) buffer.tms_stime / (float)clk_tck;
  return (tarray[0]+tarray[1]);

Quote:
}



Tue, 29 Sep 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. G77,Linux and etime

2. idate, etime, and itime in g77

3. small example for etime/dtime with g77

4. etime equivalent under Linux

5. g77 with AMDK6-2/Linux and with PII/Linux

6. g77 0.5.18 on Linux lacks ETIME intrinsic? (compiling LAPACK)

7. GNAT, g77 and Linux

8. reading unix binary datafile with linux g77

9. g77 binaries for linux on x86 systems

10. g77 on RedHat Linux

11. question on g77 / gcc interoperability on linux

12. ANNOUNCE: g77_i386_fpe_demo (Demonstrates trapping floating-point exceptions under g77/i386/Linux)

 

 
Powered by phpBB® Forum Software