home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8707 / 49 / timer.cl < prev    next >
Encoding:
Text File  |  1990-07-13  |  1.2 KB  |  34 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; File:         timer.cl
  3. ; Description:  The timer function for Gabriel's test suite.
  4. ; Author:       Robert Kessler, Will Galway and Stan Shebs
  5. ; Created:      05-Mar-84
  6. ; Modified:     16-Dec-85 (Stan Shebs)
  7. ; Mode:         PCLS
  8. ; Package:      User
  9. ; Status:       Experimental
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12. ;;; Invoke this function to run a benchmark.  The first argument is a string
  13. ;;; identifying the benchmark, while the second is the form to be evaluated.
  14.  
  15. (defun run-benchmark (name form)
  16.   (let ((fname (gentemp)))
  17.     (eval `(defun ,fname () ,(build-timer-function name form)))
  18.     (compile fname)
  19.     (apply fname nil)))
  20.  
  21. ;;; The following function builds the body of the timer function
  22.  
  23. (defun build-timer-function (string form)
  24.   (setq string (string string))
  25.   `(progn
  26.  
  27.      (format t "~%--------------------------------------------------------~%")
  28.      (format t "~A~%" ,string)
  29.      (format t "Timing performed on ~A ~A running ~A ~A on ~A.~%"
  30.              (machine-type) (machine-version)
  31.              (software-type) (software-version)
  32.              (machine-instance))
  33.      (time ,form))) 
  34.