home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!ulowell!woods.ulowell.edu!welchb
- From: welchb@woods.ulowell.edu
- Subject: Re: cpu time measurement on VMS
- Message-ID: <1993Jan21.142131.1@woods.ulowell.edu>
- Lines: 76
- Sender: usenet@ulowell.ulowell.edu (News manager - ulowell)
- Organization: University of Lowell
- References: <1993Jan20.164619.8700@eecs.nwu.edu>
- Date: Thu, 21 Jan 1993 19:21:31 GMT
-
- In article <1993Jan20.164619.8700@eecs.nwu.edu>, shil@eecs.nwu.edu (Lei Shi) writes:
- > Hi:
- >
- > I am a new user of OpenVMS running on Alpha. I have a problem and I am asking
- > for your help. I have a FORTRAN program. I compile and link it and use run
- > command to run it. My question is how I can measure the total CPU used by the
- > execution of the program. In UNIX, I can easily use time to do it.
- > But how do I do it in VMS? Can some one help me? Thanks a lot.
- >
- > Your Sincerely,
- >
- > Lei Shi
- >
- > -------------------------------------------------------------------
- > Lei Shi | Department of Electrical Engineering and
- > shil@eecs.nwu.edu | Computer Science
- > i | Northwestern University
- > Work: (708)467-2299 | Evanston, IL 60208-3118
- c---- timer2.for
- PROGRAM TIMER
- C
- C Program to illustrate the use of commands that
- C allow CPU time for execution to be determined.
- C
- C This version writes timer statistics to output file.
- C
- INTEGER*4 TIMER_ADDR,TIMER_ROUTINE
- EXTERNAL TIMER_ROUTINE
- C declare library routines
- INTEGER*4 LIB$INIT_TIMER,LIB$SHOW_TIMER
- C declare as external
- EXTERNAL LIB$INIT_TIMER,LIB$SHOW_TIMER
- C set up work variables
- INTEGER*4 STATUS
- C
- C create output file
- CALL ASSIGN(2,'TIMER.OUT')
- C
- TIMER_ADDR=0
- C
- C set timer
- STATUS=LIB$INIT_TIMER(TIMER_ADDR)
-
- c---------------------------------------------------------------------
- C sample do loop to use some CPU time
- c----------------- your thing to be timed goes here ----------------
- DO 100 I=1,50 ! remove these 4 lines
- WRITE(2,80) I
- 80 FORMAT(1X,' I =',I4)
- 100 CONTINUE
- c---------------------------------------------------------------------
- C
- C get CPU time statistics
- STATUS=LIB$SHOW_TIMER(TIMER_ADDR,,TIMER_ROUTINE,)
- C
- C
- TYPE120
- 120 FORMAT(//,1X,'OUTPUT IN "TIMER.OUT"',/)
- C
- STOP
- END
- INTEGER FUNCTION TIMER_ROUTINE(STATS)
- C
- C subroutine to output timer statistics
- C
- CHARACTER*(*) STATS
- C
- C must return success value of 1
- TIMER_ROUTINE = 1
- C
- C output timer stat line
- WRITE(2,100) STATS
- 100 FORMAT(//,1X,'TIMER STATISTICS:',/,1X,A)
- END
- --
- Brendan Welch, UMass/Lowell, W1LPG, welchb@woods.ulowell.edu
-