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

  1. -- A000051
  2. --
  3. -- This is an executable procedure that can be called outside
  4. -- whatever is being measured.
  5. -- This version just prints present WALL time and CPU time.
  6. -- Other versions are avaliable that compute differences and save
  7. -- results on disk.
  8. --
  9. -- USAGE :
  10. --             A000051          (1)
  11. --             A000051          (2)
  12. --             A000051          (3)
  13. --             run being measured
  14. --             A000051          (4)
  15. --
  16. -- RESULT :
  17. --             ( (4) - (3) ) - ( (2) - (1) ) is the measurement
  18. --
  19. --             The second expression takes out the time to make the
  20. --             measurement. As a check, (3) - (2) should be close to (2) - (1)
  21. --
  22.  
  23. with CPU_TIME_CLOCK ;  -- various choices on tape
  24. with CALENDAR ; -- used for WALL clock times
  25. with TEXT_IO ;  -- for printing times
  26. with DURATION_IO ; -- for printing times
  27.  
  28. procedure A000051 is
  29. begin
  30.   TEXT_IO.PUT ( " CPU time now=" ) ;
  31.   DURATION_IO.PUT ( CPU_TIME_CLOCK ) ;
  32.   TEXT_IO.PUT ( "        WALL time now=" ) ;
  33.   DURATION_IO.PUT ( CALENDAR.SECONDS(CALENDAR.CLOCK) ) ;
  34.   TEXT_IO.PUT_LINE ( " seconds." ) ;
  35. end A000051 ;
  36.