home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / piwg / a000052.ada < prev    next >
Encoding:
Text File  |  1988-05-03  |  1.4 KB  |  43 lines

  1. -- A000052
  2. --
  3. -- This is an executable procedure that can be called outside
  4. -- whatever is being measured.
  5. -- This version works in conjunction with A000053,A000054,A000055
  6. -- to measure CPU time and WALL time without modifying the tests
  7. -- There will be a file named A000052D created and used by these
  8. -- procedures.
  9. --
  10. -- USAGE :
  11. --             A000052
  12. --               optional control
  13. --             A000053
  14. --             A000054
  15. --               test being measured
  16. --             A000055
  17. --
  18. -- RESULT :
  19. --             ( (55) - (54) ) - ( (53) - (52) ) is the measurement
  20. --
  21. --             The second expression takes out the time to make the
  22. --             measurement. As a check, (3) - (2) should be close to (2) - (1)
  23. --
  24. --             The printout gives the CPU and WALL time in seconds for
  25. --             the run being measured.
  26. --
  27.  
  28. with CPU_TIME_CLOCK ;  -- various choices on tape
  29. with CALENDAR ; -- used for WALL clock times
  30. with TEXT_IO ;  -- for printing times
  31. with DURATION_IO ; -- for printing times
  32.  
  33. procedure A000052 is
  34.   MY_FILE : TEXT_IO.FILE_TYPE ;
  35. begin
  36.   TEXT_IO.CREATE ( MY_FILE , TEXT_IO.OUT_FILE , "A000052D" ) ;
  37.   TEXT_IO.PUT ( MY_FILE , " '52 CPU time =" ) ;
  38.   DURATION_IO.PUT ( MY_FILE , CPU_TIME_CLOCK ) ;
  39.   TEXT_IO.PUT ( MY_FILE , "        WALL time =" ) ;
  40.   DURATION_IO.PUT ( MY_FILE , CALENDAR.SECONDS(CALENDAR.CLOCK) ) ;
  41.   TEXT_IO.PUT_LINE ( MY_FILE , " seconds." ) ;
  42. end A000052 ;
  43.