Google
 

Trailing-Edge - PDP-10 Archives - BB-H138A-BM - 3a-sources/watch.mac
There are 22 other files named watch.mac in the archive. Click here to see a list.
;<3A.UTILITIES>WATCH.MAC.4, 31-May-78 15:18:48, EDIT BY BOSACK
;<3A.UTILITIES>WATCH.MAC.2, 27-Feb-78 14:31:11, Edit by BORCHEK
;make append output work again
;<3-UTILITIES>WATCH.MAC.6,  8-Nov-77 10:51:33, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<3-UTILITIES>WATCH.MAC.5, 26-Oct-77 11:21:45, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-UTILITIES>WATCH.MAC.4, 11-Jul-77 17:28:31, EDIT BY MURPHY
;ADD/CHANGE AJBL, DSKR, DSKW, SWPR, UPGS, FPGS
;SNARK:<3-UTILITIES>WATCH.MAC.2,  2-May-77 14:15:18, EDIT BY CURRIER
;TCO #1789 - CHECK FOR ENUFF TABLE SPACE
;<2-UTILITIES>WATCH.MAC.17, 20-Jan-77 14:18:01, EDIT BY HURLEY
;FIX HELP MESSAGE
;<2-UTILITIES>WATCH.MAC.16, 27-Dec-76 17:08:19, EDIT BY HURLEY
;<2-UTILITIES>WATCH.MAC.15,  3-Nov-76 11:44:36, EDIT BY MURPHY
;<2-UTILITIES>WATCH.MAC.13, 11-Oct-76 14:48:19, EDIT BY MURPHY
;<2-UTILITIES>WATCH.MAC.8, 11-Oct-76 08:52:15, EDIT BY HURLEY
;<2-UTILITIES>WATCH.MAC.7,  7-Oct-76 17:58:24, EDIT BY MURPHY
;<2-UTILITIES>WATCH.MAC.2, 29-Sep-76 21:30:17, EDIT BY HURLEY
;MAKE WATCH RUN UNDER RELEASE 2
;<2-UTILITIES>WATCH.MAC.1, 26-Jul-76 17:08:32, EDIT BY MURPHY
;<MURPHY>WATCH.MAC.7, 26-Jul-76 12:09:42, EDIT BY MURPHY
;<MURPHY>WATCH.MAC.6, 23-Jul-76 18:46:37, EDIT BY MURPHY
;<MURPHY>WATCH.MAC.4, 23-Jul-76 18:41:10, EDIT BY MURPHY
;TCO #1476 - JOB SUMMARY AND MONITOR STATISTICS QUESTIONS; ETC.
;<MURPHY>WATCH.MAC.3, 23-Jul-76 16:09:46, EDIT BY MURPHY
;<MURPHY>WATCH.MAC.2, 23-Jul-76 15:34:42, EDIT BY MURPHY
;TCO #1475 - ADDITIONAL INFORMATION; 24 HOUR BUG; BETTER EXPLANATIONS
;<1A-UTILITIES>WATCH.MAC.6,  6-MAY-76 11:04:15, EDIT BY HURLEY
;<1A-UTILITIES>WATCH.MAC.3,  8-APR-76 11:53:54, EDIT BY HURLEY
;TCO 1244 - ADD .DIRECT .XTABM FOR MACRO 50 ASSEMBLIES
;<1A-UTILITIES>WATCH.MAC.2, 31-MAR-76 09:48:04, EDIT BY HURLEY
;TCO # 1227 - ADD TOPS-20 ENTRY VECTOR AND VERSION NUMBER
;<MACK>WATCH.MAC.3, 23-FEB-76 09:15:34, Edit by MACK
;REVISED ABBREVIATION LIST -- AAM.
;<UTILITIES-MACK>WATCH.MAC.5, 11-JAN-76 16:25:04, EDIT BY LEWINE
; NEW WATCH/SWATCH HYBRID --- 01 AUG 75 --- AA. MACK



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976, 1977, 1978 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

	TITLE WATCH

	SEARCH MACSYM,MONSYM
	.REQUIRE SYS:MACREL
	SALL
   IFDEF .PSECT,<		;IF MACRO 51 OR BETTER,
	.DIRECT FLBLST>		;MAKE BETTER LISTING
   IFNDEF .PSECT,<
	.DIRECT .XTABM>
	MLON

; VERSION NUMBER DEFINITIONS

VMAJOR==3			;MAJOR VERSION OF WATCH
VMINOR==1			;MINOR VERSION NUMBER
VEDIT==7			;EDIT NUMBER
VWHO==0				;GROUP WHO LAST EDITED PROGRAM (0=DEC DEVELOPMENT)

VWATCH== <VWHO>B2+<VMAJOR>B11+<VMINOR>B17+VEDIT
;ACCUMULATORS

F=0				;FLAGS
A=1
 T1=A
B=2
 T2=B
C=3
 T3=C
D=4

E=5
FF=6				; DITTO
G=7				; DITTO

P1=10
P2=11

P=17

NMIN==^D<15*60>			; NO. OF SECONDS IF UNDER JOB 0

FLDSIZ==12
JBMAX==^D200			;SIZE OF JOB TABLES

;FLAGS IN F

JOBSMF==1B0			;PRINT JOB SUMMARY
STATF==1B1			;PRINT MONITOR STATISTICS SUMMARY
NOTIMF==1B2			;NO TIME PERIOD GIVEN
;PROGRAM ENTRY VECTOR

ENTVEC:	JRST WATCH		;STARTING LOCATION
	JRST WATCH		;REENTER LOCATION
	VWATCH			;VERSION NUMBER

WATCH:	RESET
	MOVE P,[IOWD PDLEN,PDL]
	SETZ F,
	MOVE A,[SIXBIT/JOBRT/]
	SYSGT
	HLRE A,B
	MOVNM A,NJOBS
	CAMGE A,[-JBMAX]	; ENUFF ROOM?
	 JRST [HRROI A,[ASCIZ/
? NOT ENOUGH ROOM IN JOB TABLES!
/]
	       PSOUT
	       HALTF]
	GJINF
	JUMPE C,[MOVSI A,1
		HRROI B,[ASCIZ/<SYSTEM>WATCH.LOG/]
		GTJFN
		 JRST [	MOVSI A,400001
			HRROI B,[ASCIZ/PS:<SYSTEM>WATCH.LOG/]
			GTJFN
			 JRST [HRROI A,[ASCIZ/
? WATCH NOT BEING PERFORMED!
/]
				PSOUT
				HALTF
				JRST WATCH]
			JRST .+1]
		MOVEM A,OJFN
		MOVE B,[70000,,120000]
		OPENF
		 JRST [HRROI A,[ASCIZ/
? WATCH NOT BEING PERFORMED!
/]
			PSOUT
			HALTF
			JRST WATCH]
		TXO F,JOBSMF+STATF ;DO ALL OUTPUT
		MOVE B,[NMIN]	;USE DEFAULT TIME PERIOD
		JRST GOTTIM]
	TMSG <
WATCH >
	MOVEI A,.PRIOU
	MOVE B,[VWATCH]		;PRINT WATCH VERSION
	CALL PVERID
	TMSG <, /H for help.
>
GOJFN:	TMSG <Output to file: >
	PBIN			;CHECK FIRST CHAR
	CAIN A,"?"
	JRST [	TMSG < Output filespec for WATCH output.
>
		JRST GOJFN]
	CAIN A,"/"		;SWITCH?
	JRST [	CALL RDLINE	;YES, GET NAME
		LDB A,[POINT 7,STRING,6] ;GET FIRST CHAR OF SWITCH
		CAIN A,"H"	;HELP?
		JRST DOHLP	;YES, TYPE LONG MESSAGE
		TMSG <?Invalid switch.
>
		JRST GOJFN]
	MOVEI A,.PRIIN
	BKJFN			;PUT IT BACK
	 JFCL
	MOVX A,GJ%MSG+GJ%CFM+GJ%FNS+GJ%SHT
	MOVE B,[100,,101]
	GTJFN
	 JRST [	CALL ERMSG
		JRST WATCH]
	MOVEM A,OJFN
	MOVE B,[70000,,120000]
	OPENF
	 JRST [	CALL ERMSG
		MOVE A,OJFN
		RLJFN
		 JFCL
		JRST WATCH]
	TMSG <Print monitor statistics? >
	CALL YESNO		;GET ANSWER
	SKIPE A
	TXO F,STATF		;YES
	TMSG <Print job summary ? >
	PSOUT
	CALL YESNO		;GET ANSWER
	SKIPE A
	TXO F,JOBSMF		;YES
	; ..
TIMLOP:	HRROI A,[ASCIZ/
Time period (MM:SS): /]
	PSOUT
	CALL RDLINE		;READ TO CR
	LDB A,[POINT 7,STRING,6] ;GET FIRST CHAR
	CAIN A,"?"		;HELP REQUEST?
	JRST [	HRROI A,[ASCIZ /
For fixed period reporting, enter the period as MM:SS.  Type CR
for variable period reporting.  This means that a report will
be done only when requested by typing CR.
/]
		PSOUT		;TYPE HELP
		JRST TIMLOP]	;TRY AGAIN
	CAIN A,.CHLFD		;ONLY CR TYPED?
	JRST [	TXO F,NOTIMF	;YES, FLAG
		HRROI A,[ASCIZ /
Type CR to get report.
/]
		PSOUT
		SETZ B,		;TIME IS 0
		JRST GOTTIM]
	CAIN A,":"		;STARTS WITH COLON?
	JRST [	SETZM WAITIM	;YES, ASSUME SECONDS FOLLOW
		MOVE A,[POINT 7,STRING,6]
		JRST TIMLO1]
	HRROI A,STRING
	FLIN			;SEE IF INPUT CAN BE RECOGNIZED AS
	 JRST BADTIM		; FLOATING PT - JUMP IF NOT
	LDB C,A			;OK, BUT MUST HAVE READ ENTIRE FIELD
	CAIE C," "
	CAIN C,.CHLFD
	JRST [	FMPRI B,(60.0)	;OK, CONVERT TO SECONDS
		FIXR B,B	;FIX
		JRST GOTTIM]
	CAIN C,":"		;COLON TERMINATOR?
	JRST TIMLO2		;YES, SECONDS GIVEN
BADTIM:	TMSG <?Invalid time period specification.
>
	JRST TIMLOP		;TRY AGAIN

TIMLO2:	FIXR B,B		;FIX MINUTES
	IMULI B,^D60		;CONVERT TO SECONDS
	MOVEM B,WAITIM
TIMLO1:	MOVEI C,^D10
	NIN			;YES, GET NUMBER
	 PUSHJ P,LJSHLT
	ADD B,WAITIM		;ADD TO MINUTES
	; ..
;HERE WITH: B/ TIME PERIOD IN SECONDS

	; ..
GOTTIM:	IMULI B,^D1000		;CONVERT TO MILLISECONDS
	MOVEM B,WAITIM
	TMSG <
WATCH IN OPERATION -- >
	MOVEI A,377777
	EXCH A,OJFN
	PUSH P,A
	TIME
	MOVEM A,STIME
	SETZM INTRVL
	PUSHJ P,SETUP
	JRST INTERR
	PUSHJ P,GETQS		;INIT QUEUE TIMES
	PUSHJ P,GSTATS		;INIT STATISTICS TABLES
	PUSHJ P,CALPER
	PUSHJ P,HEADER
	PUSHJ P,SORT
	PUSHJ P,TYPE
	POP P,OJFN
	JRST LPWAIT
;MAIN LOOP

LOOP:	TIME
	SUBM A,STIME		;COMPUTE ACTUAL INTERVAL
	EXCH A,STIME		;SAVE CURRENT TIME
	MOVEM A,INTRVL
	PUSHJ P,SETUP
	JRST INTERR
	PUSHJ P,GETQS		;GET QUEUE TIMES
	PUSHJ P,GSTATS		;GET STATISTICS
	PUSHJ P,CALPER
	PUSHJ P,HEADER
	PUSHJ P,SORT
	TXNE F,JOBSMF		;SKIP IF JOB SUMMARY NOT WANTED
	PUSHJ P,TYPE
	MOVE A,OJFN
	HRLI A,(1B0)
	CLOSF
	  JFCL
	HRRZ A,OJFN
	MOVE B,[70000,,120000]
	OPENF
	  JRST [MOVE B,A
		HRROI A,[ASCIZ/
? CANNOT REOPEN OUTPUT FILE!
? /]
		PSOUT
		MOVEI A,101
		SETZ C,
		HRLI B,400000
		ERSTR
		  JFCL
		  JFCL
		HALTF
		JRST WATCH]
LPWAIT:	JXO F,NOTIMF,[PBIN	;INDEF PERIOD, GET TYPEIN
		CAIE A,.CHLFD	;CR TYPED?
		JRST LPWAIT	;NO, KEEP WAITING
		JRST LOOP]	;YES, DO REPORT
	TIME
	SUB A,STIME
	MOVNS A
	ADD A,WAITIM
	SKIPL A
	DISMS
	JRST LOOP
;TYPE JOB SUMMARY

TYPE:	PUSH P,P1
	PUSH P,P2
	PUSHJ P,CRLF
	HRROI A,[ASCIZ/JOB/]
	MOVEI B,4
	PUSHJ P,TYPSTR
	HRROI A,[ASCIZ/TTY/]
	MOVEI B,4
	PUSHJ P,TYPSTR
	HRROI A,[ASCIZ/PROGRAM/]
	MOVEI B,10
	PUSHJ P,TYPSTR
	HRROI A,[ASCIZ/RUN TIME/]
	MOVEI B,12
	PUSHJ P,TYPSTR
	HRROI A,[ASCIZ/DELTA RT/]
	MOVEI B,12
	PUSHJ P,TYPSTR
	HRROI A,[ASCIZ/  %/]
	MOVEI B,10
	PUSHJ P,TYPSTR
	HRROI A,[ASCIZ/USER/]
	MOVEI B,10
	PUSHJ P,TYPSTR
	PUSHJ P,CRLF
	PUSHJ P,CRLF
	MOVN P1,NJOBS
	HRLZS P1
TYPLOP:	MOVE P2,JOBNUM(P1)
	SKIPN USER(P2)
	  JRST TYPNXT
	SKIPG DRUNTM(P2)
	  JRST TYPNXT
	MOVE A,P2
	MOVEI B,4
	PUSHJ P,TYPDEC
	SKIPGE A,TTYNUM(P2)
	  JRST [MOVE A,[ASCII/DET/]
		MOVEM A,STRING
		MOVEI B,4
		PUSHJ P,TYPFLD
		JRST TYPE2]
	MOVEI B,4
	PUSHJ P,TYPOCT
TYPE2:	MOVE A,PRGNAM(P2)
	MOVEI B,10
	PUSHJ P,TYPSIX
	MOVE A,RUNTIM(P2)
	MOVEI B,12
	PUSHJ P,TYPRT
	FLTR A,DRUNTM(P2)
	FDVR A,[1000.0]
	MOVEI B,12
	PUSHJ P,TYPFLT
	MOVE A,PERCNT(P1)
	MOVEI B,10
	PUSHJ P,TYPPER
	MOVE A,USER(P2)
	MOVEI B,6
	PUSHJ P,TYPUSR
	PUSHJ P,CRLF
TYPNXT:	AOBJN P1,TYPLOP
	POP P,P2
	POP P,P1
	POPJ P,

TYPSTR:	PUSH P,B
	MOVE B,A
	HRROI A,STRING
	SETZ C,
	SOUT
	POP P,A
	JRST TYPFLD

TYPRT:	PUSH P,B
	IDIVI A,^D1000
	IDIVI A,^D60		; B = SECONDS, A = MINUTES
	PUSH P,B
	IDIVI A,^D60		; B = MINUTES, A = HOURS
	PUSH P,B
	MOVE B,A
	HRROI A,STRING		;WRITE TIME TO BUFFER STRING
	MOVX C,<NO%LFL+NO%AST+FLD(3,NO%COL)+^D10>
	NOUT
	 JFCL
	MOVEI B,":"
	BOUT
	POP P,B			;RECOVER MINUTES
	MOVX C,<NO%LFL+NO%ZRO+FLD(2,NO%COL)+^D10>
	NOUT			;PRINT MINUES
	 JFCL
	MOVEI B,":"
	BOUT
	POP P,B			;RECOVER SECONDS
	NOUT			;PRINT SECONDS
	 JFCL
	POP P,A
	JRST TYPFLD
TYPDEC:	SKIPA C,[12]
TYPOCT:	MOVEI C,10
	PUSH P,B
	MOVE B,A
	HRROI A,STRING
	NOUT
	  SETZM STRING
	POP P,A
	JRST TYPFLD

TYPPER:	PUSH P,B
	MOVE B,A
	HRROI A,STRING
	MOVE C,[1B4!1B6!37B17!2B23!2B29]
	FLOUT
	  JRST TYPZER
	MOVEI B,"%"
	IDPB B,A
	PUSHJ P,SPACE		; SPACE OVER
	MOVEI B,0
	IDPB B,A
	POP P,A
	JRST TYPFLD

TYPUSR:	PUSH P,B
	MOVE B,A
	HRROI A,STRING
	DIRST
TYPZER:	SETZM STRING
	POP P,A
	JRST TYPFLD

TYPSIX:	PUSH P,B
	PUSHJ P,SIXTO7
	POP P,A
	JRST TYPFLD

SIXTO7:	MOVE B,[POINT 7,STRING]
	MOVE C,[POINT 6,A]
	MOVEI D,6
	ILDB E,C
	ADDI E,40
	IDPB E,B
	SOJG D,.-3
	MOVEI E,0
	IDPB E,B
	POPJ P,
TYPFLD:	MOVE D,[POINT 7,STRING]
	MOVE E,A
	MOVE A,OJFN
TYPFL1:	ILDB B,D
	JUMPE B,TYPFL2
	BOUT
	SOJA E,TYPFL1
TYPFL2:	PUSHJ P,SPACE		; SPACE OVER
	SOJG E,TYPFL2
	POPJ P,
;
; CRLF -- TURNS A NEW LINE
;
CRLF:	HRROI B,[ASCIZ/
/]
	MOVE A,OJFN
	SETZ C,
	SOUT
	POPJ P,

; JSYS ERROR ROUTINE

ERMSG:	TMSG <
? >
	JRST ERMSG0

LJSERR:	TMSG <
?JSYS ERROR: >
ERMSG0:	MOVEI A,101		; SET UP OUTJFN
	HRLOI B,.FHSLF
	SETZ C,			;
	ERSTR			; PRINT ERROR MESSAGE
	 JFCL			;
	 JFCL			; IGNORE ALL SCREWUP CONDITIONS
	HRROI A,[ASCIZ/
/]
	PSOUT			;
	POPJ P,			;

LJSHLT:	PUSHJ P,LJSERR		;DO MESSAGE
	HALTF			;QUIT
	POPJ P,			;BUT IF CONTINUED...

INTERR:	TMSG <
? WATCH: FATAL INTERNAL ERROR!
>
	HALTF
	JRST WATCH
;READ YES/NO ANSWER

YESNO:	CALL RDLINE		;READ TYPEIN TO NEXT CR
	LDB B,[POINT 7,STRING,6] ;GET FIRST CHAR OF ANSWER
	CAIN B,"?"		;HELP?
	JRST [	HRROI A,[ASCIZ /
"YES" OR "NO": /]
		PSOUT
		JRST YESNO]	;TRY AGAIN
	CAIE B,"Y"
	CAIN B,"Y"+40
	JRST [	SETO A,		;YES, RETURN NON-0
		RET]
	CAIE B,"N"
	CAIN B,"N"+40
	JRST [	SETZ A,		;NO, RETURN 0
		RET]
	HRROI A,[ASCIZ /? YES OR NO REQUIRED: /]
	PSOUT
	JRST YESNO

;READ ONE LINE FROM PRIMARY

RDLINE:	PBIN			;READ FIRST CHAR
	CAIN A,"?"		;HELP REQUEST?
	JRST [	SETZM STRING	;YES, RETURN IMMEDIATELY
		DPB A,[POINT 7,STRING,6]
		RET]
	MOVEI A,.PRIIN
	BKJFN			;NO, PUT IT BACK
	 CALL LJSERR
	MOVE A,[.PRIIN,,.PRIOU]
	HRROI B,STRING
	MOVX C,<RD%BEL+RD%JFN+RD%RAI+RD%CRF+STRNGL*5-1>
	RDTXT
	 CALL LJSHLT
	RET
;PRINT VERSION IDENTIFICATION
; A/ OUTPUT DESIGNATOR
; B/ VERSION ID WORD

PVERID:	SAVEAC <P1>
	MOVEM T2,P1		;SAVE WORD
	MOVEI T3,^D8		;ALL NUMBERS ARE OCTAL
	LOAD T2,VI%MAJ,P1	;MAJOR VERSION
	NOUT
	 JFCL
	LOAD T2,VI%MIN,P1	;MINOR
	JUMPE T2,PVER1		;PRINT NOTHING IF 0
	ADDI T2,"A"-1		;CONVERT TO ALPHABETIC
	BOUT
PVER1:	MOVEI T2,"("
	BOUT			;PUNCTUATE EDIT NUMBER
	LOAD T2,VI%EDN,P1
	NOUT
	 JFCL
	MOVEI T2,")"
	BOUT
	LOAD T2,VI%WHO,P1	;GET CUSTOMER CODE
	JUMPE T2,PVER2		;JUMP IF NONE
	MOVEI T2,"-"		;PUNCTUATE IT
	BOUT
	LOAD T2,VI%WHO,P1
	NOUT
	 JFCL
PVER2:	RET
;
; HEADER CODE BEGINS HERE
;
HEADER:	MOVE A,OJFN
	HRROI B,[ASCIZ/


WATCH SUMMARY AT /]
	SETZ C,
	SOUT
	MOVNI B,1
	SETZ C,
	ODTIM
	HRROI B,[ASCIZ/
	FOR AN INTERVAL OF /]
	SETZ C,
	SOUT
	MOVE A,INTRVL
	MOVEI B,0
	PUSHJ P,TYPRT
	MOVE A,OJFN
	HRROI B,[ASCIZ/ WITH /]
	SETZ C,
	SOUT
	PUSHJ P,SUMJOB
	MOVEI B,3
	PUSHJ P,TYPDEC
	MOVE A,OJFN
	HRROI B,[ASCIZ/ ACTIVE JOBS.
/]
	SETZ C,
	SOUT
	JXE F,STATF,SKSTAT	;JUMP IF NOT PRINTING STATISTICS
	PUSHJ P,STATS
	PUSHJ P,PQSUM		;PRINT QUEUE TIME SUMMARY
SKSTAT:	MOVE A,OJFN
	HRROI B,[ASCIZ /
LOAD AVERAGES:       /]
	SETZ C,
	SOUT
	MOVE A,[SIXBIT/SYSTAT/]
	SYSGT
	PUSH P,B
	MOVE A,0(P)
	HRLI A,14
	GETAB
	  JFCL
	MOVEI B,10
	PUSHJ P,TYPFLT
	MOVE A,0(P)
	HRLI A,15
	GETAB
	  JFCL
	MOVEI B,10
	PUSHJ P,TYPFLT
	POP P,A
	HRLI A,16
	GETAB
	  JFCL
	MOVEI B,10
	PUSHJ P,TYPFLT
	PUSHJ P,CRLF
	HRROI A,[ASCIZ /HIGH QUEUE AVERAGES: /]
	MOVEI B,.HQLAV
	PUSHJ P,DOLAV
	HRROI A,[ASCIZ /LOW QUEUE AVERAGES:  /]
	MOVEI B,.LQLAV
	PUSHJ P,DOLAV
	POPJ P,

;TYPE LOAD AVERAGES
; A/ MESSAGE
; B/ TABLE TO BE USED

DOLAV:	SAVEAC <P1>
	ASUBR <MSG,TABLE>
	HRRO A,TABLE		;REQUEST SIZE OF TABLE
	GETAB
	 RET			;NONE SUCH, DO NOTHING
	HRLZ P1,A		;SETUP AOBJN PTR
	MOVE A,OJFN
	SETZ C,
	HRRO B,MSG
	SOUT			;TYPE MESSAGE
DOLAV1:	MOVE A,TABLE
	HRL A,P1		;SETUP INDEX,,TABLE
	GETAB			;GET ENTRY
	 PUSHJ P,LJSHLT		;IMPOSSIBLE
	MOVEI B,10		;FIELD SIZE
	PUSHJ P,TYPFLT		;TYPE IT
	AOBJN P1,DOLAV1		;DO ALL
	PUSHJ P,CRLF		;END OF LINE
	RET

TYPFLT:	PUSH P,B
	MOVE B,A
	HRROI A,STRING
	MOVE C,[1B1!1B4!1B6!37B17!4B23!2B29] ;4 COLUMNS
	FLOUT
	  JRST TYPZER
	POP P,A
	JRST TYPFLD
SETUP:	PUSH P,P1
	MOVN P1,NJOBS
	HRLZS P1
SETLOP:	HRRZ A,P1
	MOVE B,[-10,,JIBLK]
	MOVEI C,0
	GETJI
	  JRST SETZER		;
	SKIPN A,JIBLK+.JIUNO
	  JRST SETZER
	MOVEM A,USER(P1)
	MOVE A,JIBLK+.JIJNO
	MOVEM A,JOBNUM(P1)
	MOVE A,JIBLK+.JITNO
	MOVEM A,TTYNUM(P1)
	MOVE A,JIBLK+.JIPNM
	MOVEM A,PRGNAM(P1)
	MOVE A,JIBLK+.JIRT
	SUB A,RUNTIM(P1)
	SKIPGE A
	  SETZ A,
	MOVEM A,DRUNTM(P1)
	MOVE A,JIBLK+.JIRT
	MOVEM A,RUNTIM(P1)
SETNXT:	AOBJN P1,SETLOP
	POP P,P1
CPOPJ1:	AOS (P)
CPOPJ:	POPJ P,

SETZER:	SETZM PERCNT(P1)
	SETZM USER(P1)
	SETZM RUNTIM(P1)
	SETZM DRUNTM(P1)
	SETOM JOBNUM(P1)
	SETOM TTYNUM(P1)
	JRST SETNXT
SUMJOB:	MOVN B,NJOBS
	HRLZS B
	SETZ A,
SUMJLP:	SKIPE USER(B)
	  AOS A
	AOBJN B,SUMJLP
	POPJ P,

CALPER:	PUSH P,P1
	FLTR A,INTRVL
	PUSH P,A
	MOVN P1,NJOBS
	HRLZS P1
CALLOP:	FLTR A,DRUNTM(P1)
	FDVR A,0(P)
	FMPR A,[100.0]
	MOVEM A,PERCNT(P1)
	AOBJN P1,CALLOP
	POP P,(P)
	POP P,P1
	POPJ P,

SORT:	PUSH P,P1
SORT1:	MOVN P1,NJOBS
	HRLZS P1
	SETZ D,
SORTLP:	MOVE A,PERCNT(P1)
	CAML A,PERCNT+1(P1)
	  JRST SORNXT
	EXCH A,PERCNT+1(P1)
	MOVEM A,PERCNT(P1)
	MOVE A,JOBNUM(P1)
	EXCH A,JOBNUM+1(P1)
	MOVEM A,JOBNUM(P1)
	SETO D,
SORNXT:	AOBJN P1,SORTLP
	JUMPN D,SORT1
	POP P,P1
	POPJ P,
;
; HERE BEGINS CODE FOR STAT GATHERING
;  --- AA. MACK
;
GSTATS:	MOVE A,[SIXBIT /SYSTAT/] ; GET SYSTEM TABLE
	SYSGT			;
	JUMPE B,[HRROI A,[ASCIZ/SYSTAT TABLE NOT FOUND
/]
		PSOUT
		HALTF]
	HRRZM B,SYSTAT		; SAVE TABLE NUMBER
	HLRE A,B		; NEGATIVE OF LENGTH
	MOVMM A,NSYST		;
	HLLM B,NSYST		; NSYST/-LENGTH,,+LENGTH
	MOVE A,[SIXBIT/JOBRT/]	; GET JOBRT TABLE
	SYSGT			;
	JUMPE B,[HRROI A,[ASCIZ/JOBRT TABLE NOT FOUND
/]
		PSOUT
		HALTF]
	HRRZM B,JOBRT		;
	HLRE A,B		;
	MOVMM A,NNJOBS		; SAME AS FOR SYSTAT
	HLLM B,NNJOBS		;
	MOVE A,[SIXBIT /XBIO/]	;TRY TO GET XB IO TABLE
	SYSGT			; ...
	HRRZM B,XBIO		;SAVE
	HLLZ E,NNJOBS		;
GTA1:	HRRZ A,JOBRT		; JOB RUNTIME TABLE
	HRLI A,0(E)		; 
	GETAB			;
	JRST [	PUSHJ P,LJSERR
		SETZ A,		; USE 0 IF FAILURE
		JRST .+1]
	MOVEM A,JNEW(E)		;
	AOBJN E,GTA1		; LOOP TO GET ALL
	HLLZ E,NSYST		; SYSTAT TABLE
GTA2:	HRRZ A,SYSTAT		;
	HRLI A,0(E)		;
	GETAB			;
	JRST [	PUSHJ P,LJSERR
		SETZ A,
		JRST .+1]
	MOVEM A,VNEW(E)		;
	AOBJN E,GTA2		; LOOP TO GET ALL 
	SKIPG A,XBIO		;GET XBIO INDEX
	JRST GTA3		;NONEX
	HRLI A,0		;FIRST GET READS
	GETAB
	 JRST GTA3
	MOVEM A,XBRNEW		;SAVE
	MOVE A,XBIO		;GET WRITES
	HRLI A,1		; ...
	GETAB
	 JRST GTA3
	MOVEM A,XBWNEW		;SAVE WRITES
GTA3:	TIME			; GET CURRENT TIME
	MOVEM A,TNEW		; SAVE IT
	POPJ P,			;
;PRINT STATISTICS

STATS:	MOVE A,TNEW		; COMPUTE SAMPLE INTERVAL
	SUBM A,TOLD		;
	PUSHJ P,CRLF		; TURN A NEW LINE
	MOVSI G,-NVALS		; SET UP TO DO ALL VALUES
	MOVNI FF,4		; 4 STATISTICS PER LINE
GO1:	HLRZ A,VNAMES(G)	; POINTER TO CALL WORD
	MOVE E,0(A)		; CALL WORD, IE. INDEX,,ROUTINE
	HLRZ A,E		; A/0,,INDEX
	PUSHJ P,0(E)		; PERFORM SPECIFIED FUNCTION
	AOBJN G,GO1		; LOOP TO DO WHOLE TABLE
	PUSHJ P,CRLF		; NEW LINE
	MOVE A,[XWD VNEW,VOLD]	; MAKE CURRENT SET BE OLD SET
	BLT A,TOLD		;   FOR NEXT TIME THRU LOOP
	POPJ P,			; BACK TO "HEADER" CODE
; DOPCT -- ITEM AS PERCENTAGE OF REALTIME INTERVAL
;
DOPCT:	MOVE B,VNEW(A)		;
	SUBB B,VOLD(A)		;
	MOVE A,B		;
DOPCT1:	IMULI A,1750		; 1750 = 1000
DOPCT3: IDIV A,TOLD		; GET PERCENT*10
	ASH B,1			; ROUNDING -- IF REMAINDER IS
	CAML B,TOLD		;  GEQ DIVISOR/2, THEN ADD 1
	ADDI A,1		;
DOPCT2:	IDIVI A,12		; SPLIT INTO