home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21641 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.7 KB  |  88 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!ulowell!woods.ulowell.edu!welchb
  3. From: welchb@woods.ulowell.edu
  4. Subject: Re: cpu time measurement on VMS
  5. Message-ID: <1993Jan21.142131.1@woods.ulowell.edu>
  6. Lines: 76
  7. Sender: usenet@ulowell.ulowell.edu (News manager - ulowell)
  8. Organization: University of Lowell
  9. References: <1993Jan20.164619.8700@eecs.nwu.edu>
  10. Date: Thu, 21 Jan 1993 19:21:31 GMT
  11.  
  12. In article <1993Jan20.164619.8700@eecs.nwu.edu>, shil@eecs.nwu.edu (Lei Shi) writes:
  13. > Hi: 
  14. >    I am a new user of OpenVMS running on Alpha. I have a problem and I am asking
  15. > for your help.  I have a FORTRAN program. I compile and link it and use run 
  16. > command to run it.  My question is how I can measure the total CPU used by the 
  17. > execution of the program.  In UNIX, I can easily use time to do it.  
  18. > But how do I do it in VMS?  Can some one help me?  Thanks a lot. 
  19. >                     Your Sincerely,
  20. >                     Lei Shi
  21. > -------------------------------------------------------------------
  22. > Lei Shi            |  Department of Electrical Engineering and 
  23. > shil@eecs.nwu.edu    |                Computer Science 
  24. > i            |  Northwestern University
  25. > Work: (708)467-2299     |  Evanston, IL 60208-3118
  26. c---- timer2.for
  27.       PROGRAM TIMER
  28. C    
  29. C          Program to illustrate the use of commands that
  30. C          allow CPU time for execution to be determined.
  31. C
  32. C          This version writes timer statistics to output file.
  33. C
  34.       INTEGER*4 TIMER_ADDR,TIMER_ROUTINE
  35.       EXTERNAL TIMER_ROUTINE
  36. C          declare library routines
  37.       INTEGER*4 LIB$INIT_TIMER,LIB$SHOW_TIMER
  38. C          declare as external
  39.       EXTERNAL LIB$INIT_TIMER,LIB$SHOW_TIMER
  40. C          set up work variables
  41.       INTEGER*4 STATUS
  42. C
  43. C          create output file
  44.       CALL ASSIGN(2,'TIMER.OUT')
  45. C
  46.       TIMER_ADDR=0
  47. C
  48. C          set timer
  49.       STATUS=LIB$INIT_TIMER(TIMER_ADDR)
  50.  
  51. c---------------------------------------------------------------------
  52. C    sample do loop to use some CPU time
  53. c-----------------  your thing to be timed goes here  ----------------
  54.       DO 100 I=1,50         ! remove these 4 lines
  55.       WRITE(2,80) I
  56.    80 FORMAT(1X,'     I =',I4)
  57.   100 CONTINUE
  58. c---------------------------------------------------------------------
  59. C
  60. C         get CPU time statistics
  61.       STATUS=LIB$SHOW_TIMER(TIMER_ADDR,,TIMER_ROUTINE,)
  62. C
  63. C
  64.       TYPE120
  65.   120 FORMAT(//,1X,'OUTPUT IN "TIMER.OUT"',/)
  66. C
  67.       STOP
  68.       END
  69.       INTEGER FUNCTION TIMER_ROUTINE(STATS)
  70. C    
  71. C          subroutine to output timer statistics
  72. C
  73.       CHARACTER*(*) STATS
  74. C
  75. C          must return success value of 1
  76.       TIMER_ROUTINE = 1
  77. C
  78. C          output timer stat line
  79.       WRITE(2,100) STATS
  80.   100 FORMAT(//,1X,'TIMER STATISTICS:',/,1X,A)
  81.       END
  82. -- 
  83. Brendan Welch, UMass/Lowell, W1LPG,  welchb@woods.ulowell.edu
  84.