;;; -*- mode:lisp;package:user;base:10;fonts:medfnt,hl12b,hl12bi -*-

;;; This file contains a sample defsystem for each of the three types of
;;; benchmark suites: batch, code-segment, and interactive.  Each system
;;; contains all of the necessary support files for running and collecting
;;; data for a specific suite of benchmarks.  The test suites used here are
;;; only for illustrative purposes and are not meant to be exhaustive
;;; benchmark suites.  On the other hand, the systems are complete -- the
;;; only thing lacking is the benchmarks you plan to define as a complete
;;; suite.

1; Kludge to get files compiled under release 2 to run on un-patched release 1 systems*
#+explorer(UNLESS (FBOUNDP 'si:*append) (FSET 'si:*append #'APPEND))

;1;; The following is to prevent unnecessary problems when running on an Explorer system *
;1;; that does not contain TCP/IP.  This conditionalization is used in the function, run-benchmarks*
#-3600 (DEFVAR *ip-present* nil "2If TCP/IP is present on the system, this variable is set to t, else nil*")
#-3600 (AND (FIND-PACKAGE 'ip)(FIND-SYMBOL 'enable 'ip)(SETQ *ip-present* t))

#+3600(setq si:gc-report-stream nil)  ; Don't let gc-reports get in the way

;;; locations of the framework, benchmark, and result files

#-3600(fs:add-logical-pathname-host "BENCH" "PUBLIC"
				    '(("bench" "rel3.bench;")
				      ("gabriel" "rel3.bench;")
				       ))

#+3600(fs:set-logical-pathname-host "BENCH" :physical-host "PUBLIC"
				    :translations
				    '(("bench" "rel3.bench;")
				      ("gabriel" "rel3.bench;")
				      ))

#-3600(fs:add-logical-pathname-host "RESULTS" "PUBLIC"
				    '(("results" "rel3.bench;")))

#+3600(fs:set-logical-pathname-host "RESULTS" :physical-host "PUBLIC"
				    :translations
				    '(("results" "rel3.bench;")))
;;;
;;;
;;;------------------------THE DEFSYSTEMS----------------------------
;;;          
;;;

(defsystem batch-benchmarks
  (:pathname-default "bench:bench;")
  (:module run "bench:bench;run-benchmarks")
  (:module run-gabriel "bench:bench;run-gabriel")
  (:module packages "packages")
  (:module benchmarks ("tak" "traverse"))
  (:module report "bench:bench;report-benchmarks")
  #-3600(:module mail "bench:bench;halt-mail")
  
  (:compile-load run)
  (:compile-load run-gabriel (:fasload run) (:fasload run))
  (:readfile packages  (:fasload run run-gabriel))
  (:compile-load benchmarks (:readfile packages) (:readfile packages))
  (:compile-load report (:fasload run))
  #-3600(:compile-load mail)
  )

(defsystem code-segment-benchmarks
  (:pathname-default "bench:bench;")
  (:module instructions "normalize-benchmarks")
  (:module arithmetic "arithmetic-benchmarks")
  (:module run "run-benchmarks")
  (:module report "report-benchmarks")
  #-3600(:module mail "halt-mail")

  (:compile-load run)
  (:compile-load instructions (:fasload run))
  (:compile-load arithmetic (:fasload run instructions))
  (:compile-load report (:fasload run))
  #-3600(:compile-load mail)
  )

(defsystem interactive-benchmarks
  (:pathname-default "bench:bench;")
  (:module run "run-benchmarks")
  (:module report "report-benchmarks")
  (:module junior "junior")
  #-3600(:module mail "halt-mail")
 
  (:compile-load run)
  (:compile-load report (:fasload run))
  (:compile-load junior (:fasload run))
  #-3600(:compile-load mail)
  )

(defsystem reports
  (:pathname-default "bench:bench;")
  (:module run "run-benchmarks")
  (:module report "report-benchmarks")
  (:module mail "halt-mail")
 
  (:compile-load run)
  (:compile-load report (:fasload run))
  (:compile-load mail))	

;;; convenience functions to load and execute the systems

(DEFUN do-batch (machine)
  (MAKE-SYSTEM 'batch-benchmarks :compile :noconfirm)
  (run-cl-gabriel machine))

(DEFUN do-code-segment (machine)
  (MAKE-SYSTEM 'code-segment-benchmarks :compile :noconfirm)
  (run-instruction machine))

(DEFUN do-interactive (machine)
  (MAKE-SYSTEM 'interactive-benchmarks :compile :noconfirm)
  (run-junior machine))








