Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!ucbvax!BRL.ARPA!glennrp From: glennrp@BRL.ARPA (Glenn Randers-Pehrson, TBD) Newsgroups: comp.sys.sgi Subject: fortran callable timer Message-ID: <8710301258.aa18323@TBD.BRL.ARPA> Date: Fri, 30-Oct-87 12:58:44 EST Article-I.D.: TBD.8710301258.aa18323 Posted: Fri Oct 30 12:58:44 1987 Date-Received: Wed, 4-Nov-87 23:37:53 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 39 Here are second.f and clockf.c, which give you a FORTRAN callable "second" subroutine: CALL SECOND (CPUTIME) You have to call second at least once every 4295 seconds or it will lose some time. ------cut here; second.f follows ------- subroutine second (time) c c returns elapsed system+user cpu time in seconds, accurate to c 1/60th second. If more than 4295 seconds elapse between calls c to second, n*4295 seconds will not be recorded. c real lasttime,thistime save lasttime, s4295 data lasttime /0.0/, s4295 /0.0/ call clockf(now) thistime=now/1 000 000. if(thistime.lt.lasttime) s4295 = s4295 + 4295. lasttime=thistime time = s4295 + thistime return end ------cut here; clockf.c follows ------- fortran clockf(thistime) /* returns unsigned integer, counting from 0 to (2**32 - 1) microseconds * in approximately 1/60th second steps, representing elapsed system+user * time. If more than 4295 seconds elapse between calls to clockf, * n*4295 seconds will not be recorded. */ long *thistime; { long clock(); *thistime = clock(); }