;
; TITLE CPU
;
; Benchmark program
;
; THIS PROGRAM MAY BE FREELY DISTRIBUTED TO AMUS MEMBERS
; COURTESY OF WHITE HOUSE SOFTWARE, INC.
;
;Edit History:
;
; 8/7/86 1.0(0) - David Greene
; Written
;
VEDIT=0.
SEARCH SYS
SEARCH SYSSYM
; Define Version Information
VMAJOR=1.
VMINOR=0.
VSUB=0.
VWHO=0.
AUTOEXTERN
OFINI
OFDEF CPU,4 ; area for current cpu usage time
OFDEF CONECT,4 ; area for start time of program
OFDEF READS,4 ; area for current number of reads
OFDEF WRITES,4 ; area for current number of writes
OFDEF CMDSIZ,4 ; area for current command file status
OFSIZ IMPSIZ ; IMPSIZ = size of needed memory
; macro to perform a type a string in lower intensity
DEFINE TYPLOW STRING
PUSH D1 ; save work register
MOV #<-1_8.+11.>,D1 ; set lower intensity
TCRT ;
TTYI ; display specified string
ASCII |STRING|
BYTE 0
EVEN
MOV #<-1_8.+12.>,D1 ; set high intensity
TCRT
POP D1 ; restore work register
ENDM ; end of macro
; Start of program
PHEAD: PHDR -1,0,PH$REE!PH$REU
TYPLOW <CPU is courtesy of White House Software, Inc.>
CRLF
BYP ; skip blanks and tabs
LIN ; end of string?
JNE CPU10
; Show usage info
CPU0:
TYPECR <Usage: CPU amos command>
CRLF
EXIT
;
; Load all current job statistics to compare
;
CPU10:
SLEEP #10800. ; sleep a bit
GETIMP IMPSIZ,A5 ; get memory into A5
JOBIDX A0 ; A0 now indexes my Job Control Block
MOV JOBCMZ(A0),CMDSIZ(A5) ; save current command file size
MOV JOBCPU(A0),CPU(A5) ; save cpu time used up to this point
GTIMEI CONECT(A5) ; get starting time
MOV JOBDSR(A0),READS(A5) ; get number of disks reads so far
MOV JOBDSW(A0),WRITES(A5) ; and writes too..
; Perform the requested command
CPU20:
SAVE A0,A5 ; save all registers we are using
AMOS ; execute the command
REST A0,A5 ; restore out registers
; The AMOS call does execute command files the way it should.
; Instead of processing the whole command file, it just
; loads the it into the correct area in memory. It is up to the user
; to process it. Note that we cannot just test the JOBCMZ word
; to see if there is a command file running because a command
; file may have invoked this program.
CMMW JOBCMZ(A0),CMDSIZ(A5) ; did we load a command file ?
BLOS CPU30 ; nope - we're done
CALL SHWDOT ; yes - show the correct AMOSL prompt
KBD ; get the next command to be executed
BR CPU20 ; and processit
; Were done with executing the program, now lets calulate the
; CPU time used, elapsed time, and the number of disk reads and
; writes the program used
CPU30:
CRLF ; aesthetics
SUB A2,A2 ; clear A2 for the $OTCPU call
TYPLOW <Bench mark statistics:>
CRLF
; Show the amount of CPU time this program took up
MOV JOBCPU(A0),D1 ; get current CPU time used
SUB CPU(A5),D1 ; subtract the amont that we had..
TAB ; before we executed the program
TYPLOW <CPU time spent: > ; show amount of CPU time used
CALL $OTCPU ; by this program
CRLF
; Show amount of actual time program used
GTIMEI D1 ; get current time
SUB CONECT(A5),D1 ; subtract time we had before
MUL D1,#778. ; convert to jiffies for $OTCPU
TAB
TYPLOW <Elapsed time: > ; show elapsed time
CALL $OTCPU
CRLF
; Show the number of times this program read the disk
MOV JOBDSR(A0),D1 ; get current number
SUB READS(A5),D1 ; subtract old number
TAB
TYPLOW <Disk reads: > ; show number of reads
DCVT 0,OT$TRM
CRLF
; Show the number of times this program wrote to the disk
MOV JOBDSW(A0),D1 ; get current number
SUB WRITES(A5),D1 ; get old number
TAB
TYPLOW <Disk writes: > ; show number of writes
DCVT 0,OT$TRM
CRLF
EXIT ; exit back to AMOS/L
; SHWDOT
; This routines displays the correct system prompt
; for this job. It understands that the prompt may be
; be different than a dot on operating systems 1.3 and later
SHWDOT:
CMP JOBESZ,#JOBTBE ; are we a 1.3 system ?
BLO 10$ ; no - just show a dot
TTYL JOBPRM(A0) ; yes - display the current prompt
BR 20$ ;
10$:
TYPE <.> ; AMOS/L 1.2 and earlier
20$:
RTN ; return