home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21598 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  4.6 KB

  1. Xref: sparky comp.os.vms:21598 biz.dec.workstations:52 vmsnet.alpha:121
  2. Newsgroups: comp.os.vms,biz.dec.workstations,vmsnet.alpha
  3. Path: sparky!uunet!spool.mu.edu!srvr1.engin.umich.edu!batcomputer!ghost.dsi.unimi.it!insa-lyon.fr!univ-lyon1.fr!scsing.switch.ch!dxcern!vaxfpd.pd.infn.it!michelotto
  4. From: michelotto@vaxfpd.pd.infn.it (Michele Michelotto)
  5. Subject: Re: cpu time measurement on VMS
  6. Message-ID: <1993Jan21.073627.881@dxcern.cern.ch>
  7. Sender: news@dxcern.cern.ch (USENET News System)
  8. Reply-To: michelot@dxcern.cern.ch
  9. Organization: CERN - European Laboratory for Particle Physics
  10. References:  <1993Jan20.164619.8700@eecs.nwu.edu>
  11. Date: Thu, 21 Jan 1993 07:36:27 GMT
  12. Lines: 112
  13.  
  14.  
  15. In article <1993Jan20.164619.8700@eecs.nwu.edu>, shil@eecs.nwu.edu (Lei Shi) writes:
  16.  
  17. |>   I am a new user of OpenVMS running on Alpha. I have a problem and I am asking
  18. |>for your help.  I have a FORTRAN program. I compile and link it and use run 
  19. |>command to run it.  My question is how I can measure the total CPU used by the 
  20. |>execution of the program.  In UNIX, I can easily use time to do it.  
  21. |>But how do I do it in VMS?  Can some one help me?  Thanks a lot. 
  22. |>
  23. Try this program that I found on Usenet some times ago.    M0ichele
  24.  
  25. Try the following command file - just use @TIME command.  (There will be the
  26. usual problems with quoted arguments, since one level of quotation marks will
  27. be stripped off.)
  28.  
  29. The command file actually displays all the statistics it can get its hands on.
  30. Note that VMS only maintains the peak virtual size and peak working set values
  31. from the time the process started, so unless this particular command increased
  32. the values, there is no way to know what the peaks for the command were.
  33.  
  34. I make no claims about the quality of this code; it was something I through
  35. together quickly at some point when I needed it.
  36.                             -- Jerry
  37.  
  38. $! TIME.COM
  39. $! V2.0        Jerry Leichter
  40. $!
  41. $ on error then continue
  42. $ assign/user SYS$COMMAND SYS$INPUT
  43. $ start_dirio = f$getjpi("","DIRIO")
  44. $ start_bufio = f$getjpi("","BUFIO")
  45. $ start_faults = f$getjpi("","PAGEFLTS")
  46. $ start_virtpeak = f$getjpi("","VIRTPEAK")
  47. $ start_wspeak = f$getjpi("","WSPEAK")
  48. $ start_dt = f$time()
  49. $ start_cpu = f$getjpi("","CPUTIM")
  50. $'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'
  51. $ end_cpu = f$getjpi("","CPUTIM")
  52. $ end_dt = f$time()
  53. $ end_dirio = f$getjpi("","DIRIO")
  54. $ end_bufio = f$getjpi("","BUFIO")
  55. $ end_faults = f$getjpi("","PAGEFLTS")
  56. $ end_virtpeak = f$getjpi("","VIRTPEAK")
  57. $ end_wspeak = f$getjpi("","WSPEAK")
  58. $ deas/user/all                !Clean up SYS$INPUT; bad method....
  59. $ cpu = f$integer(end_cpu) - f$integer(start_cpu)
  60. $ cpu_s = cpu/100
  61. $ cpu_hu = cpu - 100*cpu_s
  62. $ if cpu_hu .lt. 10 then cpu_hu = "0" + f$string(cpu_hu)
  63. $ el_h = f$integer(f$cvtime(end_dt,"ABSOLUTE","HOUR"))            -
  64.         - f$integer(f$cvtime(start_dt,"ABSOLUTE","HOUR"))
  65. $ el_m = f$integer(f$cvtime(end_dt,"ABSOLUTE","MINUTE"))        -
  66.         - f$integer(f$cvtime(start_dt,"ABSOLUTE","MINUTE"))
  67. $ el_s = f$integer(f$cvtime(end_dt,"ABSOLUTE","SECOND"))        -
  68.         - f$integer(f$cvtime(start_dt,"ABSOLUTE","SECOND"))
  69. $ el_hu = f$integer(f$cvtime(end_dt,"ABSOLUTE","HUNDREDTH"))    -
  70.         - f$integer(f$cvtime(start_dt,"ABSOLUTE","HUNDREDTH"))
  71. $ if el_hu .lt. 0
  72. $ then
  73. $    el_s = el_s - 1
  74. $    el_hu = el_hu + 100
  75. $ endif
  76. $ if el_s .lt. 0
  77. $ then
  78. $    el_m = el_m - 1
  79. $    el_s = el_s + 60
  80. $ endif
  81. $ if el_m .lt. 0
  82. $ then
  83. $    el_h = el_h - 1
  84. $    el_m = el_m + 60
  85. $ endif
  86. $ if el_h .lt. 0
  87. $ then
  88. $    write SYS$OUTPUT "Elapsed time crossed midnight:  "        -
  89.         start_dt," - ",end_dt
  90. $    el_h = 0
  91. $ endif
  92. $ dirio = f$integer(end_dirio) - f$integer(start_dirio)
  93. $ bufio = f$integer(end_bufio) - f$integer(start_bufio)
  94. $ faults = f$integer(end_faults) - f$integer(start_faults)
  95. $ el = "''el_h':''el_m':''el_s'.''el_hu'"
  96. $ cp = f$string(cpu_s) + "." + f$string(cpu_hu)
  97. $ if start_virtpeak .lt. end_virtpeak
  98. $ then
  99. $    virtpeak = end_virtpeak
  100. $ else
  101. $    virtpeak = "could not be determined"
  102. $ endif
  103. $ if start_wspeak .lt. end_wspeak
  104. $ then
  105. $    wspeak = end_wspeak
  106. $ else
  107. $    wspeak = "could not be determined"
  108. $ endif
  109. $ write SYS$OUTPUT "Elapsed ",f$cvtime(el,"ABSOLUTE","TIME"),", CPU ",cp
  110. $ write SYS$OUTPUT                            -
  111.     "Incremental DIRIO ''dirio', BUFIO ''bufio', Faults ''faults'"
  112. $ write SYS$OUTPUT                            -
  113.     "Peak virtual size ",virtpeak,", working set ",wspeak
  114.  
  115.  
  116.  
  117.  
  118. --
  119.                         Ciao, Michele
  120. ******************************************************************************
  121. * Michele Michelotto, INFN Padova, Delphi group.                             *
  122. * Internet: michelot@dxcern.cern.ch     BITNET: MICHELOTTO@IPDINFN           *
  123. * Tel (+39).49.844347                   HEPNET: VAXFPD::MICHELOTTO           *
  124. *                     "Ho bevuto CHE COSA ?"   (Socrate)                     *
  125. ******************************************************************************
  126.