C
C	PLTSYS
C
C	PROGRAM TO MAKE PLOT FILE FROM SYSREP'S
C	PLTDAT.DAT
C
C	MIKE BARNES
C	UTHSCD(MCRC)
C
	INCLUDE 'PLTSYS.PRM'
	CALL PLOTS(I)
300	CALL GETFIL(K71)
	DO 20 I1 = 1,30
20	READ(21) IPLTST(I1)
	DO 10 I1 = 1,20
	DO 10 I2 = 1,49
10	READ(21) A(I1,I2)
	DO 200 I3 = 1,NUMDSK
	DO 200 I4 = 1,20
	DO 200 I5 = 1,49
200	READ(21) B(I3,I4,I5)
	CLOSE(UNIT=21)
30	FORMAT(A3)
40	FORMAT(' PLOT NUMBER OF LOGINS? ',$)
50	FORMAT(' PLOT UUO/SEC? ',$)
60	FORMAT(' PLOT CONTEXT SWITCHES/SEC? ',$)
70	FORMAT(' PLOT NUMBER OF COMMANDS? ',$)
80	FORMAT(' PLOT CPU UTILIZATION? ',$)
90	FORMAT(' PLOT CPU IDLE TIME? ',$)
100	FORMAT(' PLOT NUMBER OF ACTIVE LINES? ',$)
110	FORMAT(' PLOT NUMBER OF SWAP I/O''S? ',$)
120	FORMAT(' PLOT CPU OVERHEAD? ',$)
130	FORMAT(' PLOT CPU USER TIME? ',$)
140	FORMAT(' PLOT CPU LOST TIME? ',$)
C150	FORMAT(' PLOT % FULL OF DISKS? ',$)
160	FORMAT(' PLOT NUMBER OF JOBS RUN OUT OF ORDER? ',$)
170	FORMAT(' PLOT NUMBER OF REQUEUES PER SECOND? ',$)
180	FORMAT(' PLOT PERCENT SWAPPER IDLE? ',$)
190	FORMAT(' PLOT AVERAGE JOB SIZE? ',$)
	WRITE(5,40)
	READ(5,30) K
	IF (K .EQ. 'DEF') CALL DEFAUL
	IF ((K71 .EQ. 1) .AND. (K .EQ. 'DEF')) GOTO 300
	IF (K .EQ. 'DEF') STOP
	IF (K .EQ. 'YES') CALL PLTLOG
	WRITE(5,50)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTUUO
	WRITE(5,60)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTCTS
	WRITE(5,70)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTCMD
	WRITE(5,80)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTCPU
	WRITE(5,90)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTIDL
	WRITE(5,100)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTACT
	WRITE(5,110)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTIO
	WRITE(5,120)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTOVH
	WRITE(5,130)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTUSR
	WRITE(5,140)
	READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTLST
C	WRITE(5,150)
C	READ(5,30) K
C	IF (K .EQ. 'YES') CALL PLKFUL
	WRITE(5,160); READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTJOO
	WRITE(5,170); READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTRPS
	WRITE(5,180); READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTPSN
	WRITE(5,190); READ(5,30) K
	IF (K .EQ. 'YES') CALL PLTJSZ
	IF (K71 .EQ. 1) GOTO 300
	STOP
	END
	SUBROUTINE PLTUSR
C
C	--PLOT %USER
C
	CALL PLTTL('TIME VS CPU USER TIME',21)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTBLK(13)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTOVH
C
C	--PLOT OVERHEAD TIME
C
	CALL PLTTL('TIME VS CPU OVERHEAD',20)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTBLK(12) !OVRH
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTLST
C
C	--PLOT LOST TIME
C
	CALL PLTTL('TIME VS CPU LOST TIME',21)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTBLK(3)  !LOST
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE DEFAUL
	IMPLICIT INTEGER(A-Z)
	DOUBLE PRECISION A
	OPEN(UNIT=21,FILE='DEFAUL.BOS',ACCESS='SEQIN')
10	READ(21,20,END=30) A
20	FORMAT(A10)
	IF(A .EQ. 'LOGINS') CALL PLTLOG
	IF(A .EQ. 'UUO/SEC') CALL PLTUUO
	IF(A .EQ. 'CTSW/SEC') CALL PLTCTS
	IF(A .EQ. 'COMMANDS') CALL PLTCMD
	IF(A .EQ. 'IDLE') CALL PLTIDL
	IF(A .EQ. 'USER') CALL PLTUSR
	IF(A .EQ. 'LOST') CALL PLTLST
	IF(A .EQ. 'OVHD') CALL PLTOVH
	IF(A .EQ. 'LINES') CALL PLTACT
	IF(A .EQ. 'SWAP') CALL PLTIO
C	IF(A .EQ. 'DSKFUL') CALL PLKFUL
	IF(A .EQ. 'JOBSIZE') CALL PLTJSZ
	IF(A .EQ. 'SWAPPER') CALL PLTPSN
	IF(A .EQ. 'REQUEUE') CALL PLTRPS
	IF(A .EQ. 'JBORDER') CALL PLTJOO
	GOTO 10
30	CLOSE(UNIT=21)
	RETURN
	END
	SUBROUTINE PLTIO
	INCLUDE 'PLTSYS.PRM'
C
C	--PLOT SWAP I/O'S
C
	CALL PLTTL('TIME VS SWAP I/O''S',18)
	IF (AUSTIN .EQ. 1) CALL SETSCL(1500000,5)
	IF (AUSTIN .EQ. 0) CALL SETSCL(600000,5)
	CALL SCL
	CALL PLTBLK(9)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTACT
C
C	--PLOT ACTIVE LINES
C
	CALL PLTTL('TIME VS ACTIVE LINES',20)
	CALL SETSCL(40,5)
	CALL SCL
	CALL PLTBLK(7)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTIDL
C
C	--PLOT CPU IDLE TIME
C
	CALL PLTTL('TIME VS CPU IDLE TIME',21)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTBLK(11)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTBLK(I1)
	INCLUDE 'PLTSYS.PRM'
C
C	--GET STARTING COORD
C
	I = 1
20	IF (A(I1,I) .NE. -2) GOTO 10
	I = I+1
	GOTO 20
10	IF (I .GE. 49) RETURN
C
C	--PLOT FIRST POINT
C
	CALL PLOT(S(A(I1,I)),D(I),3)
	CALL PLOT(S(A(I1,I)),D(I+1),2)
C
C	--PLOT GRAPH
C
	MODE = 2
	DO 30 I = I,49
	J = I
	IF (A(I1,J) .LT. 0) GOTO 40
	CALL PLOT(S(A(I1,J)),D(J),MODE)
	CALL PLOT(S(A(I1,J)),D(J+1),MODE)
	IF (MODE .EQ. 3) MODE = 2
	GOTO 30
40	MODE = 3
30	CONTINUE
C
C	--FINISH
C
	CALL PLOT(0.,0.,3)
	RETURN
	END
	SUBROUTINE PLTWDC
C
C	--PLOT WDCL/SEC
C
	CALL PLTTL('TIME VS WORDS CLEARED/SEC',25)
	CALL SETSCL(2000,5)
	CALL SCL
	CALL PLTGRH(6)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTCPU
C
C	--PLOT %IDLE, %LOST, %OVRH, %USER
C
	CALL PLTTL('TIME VS CPU UTILIZATION',23)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTBLK(12) !OVRH
	CALL PLTBLK(13) !USER
	CALL PLTBLK(3)  !LOST
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTUUO
C
C	--PLOT UUO/SEC
C
	CALL PLTTL('TIME VS UUO/SEC',15)
	CALL SETSCL(1000,5)
	CALL SCL
	CALL PLTBLK(4)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTCTS
C
C	--PLOT CTSW/SEC
C
	CALL PLTTL('TIME VS CTSW/SEC',16)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTBLK(5)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTCMD
C
C	--PLOT COMMANDS
C
	CALL PLTTL('TIME VS COMMANDS',16)
	CALL SETSCL(10000,5)
	CALL SCL
	CALL PLTBLK(2)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE SCL
	COMMON/SCAL/ MAXRNG,MAXPT
	POINTS = FLOAT(MAXRNG)/10.
	SPACE = FLOAT(MAXPT)/POINTS
	XRAY = 0.5
	J = POINTS
	DO 10 I = 1,10
	CALL PLOT(XRAY,0.,3)
	CALL PLOT(XRAY,.1,2)
	CALL PLOT(XRAY,-.1,2)
	Z = .45
	IF (J .GE. 10000) Z = .65
	CALL NUMBER(XRAY,Z,.1,FLOAT(J),-90.,-1)
	J = J+POINTS
	XRAY = XRAY + .5
10	CONTINUE
	RETURN
	END
	SUBROUTINE PLTLOG
C
C	--PLOT NUMBER OF LOGINS
C
	CALL PLTTL('TIME VS LOGNUM',14)

	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTGRH(1)
	CALL PLTFIN
	RETURN
	END
	REAL FUNCTION D(DTAPNT)
	INTEGER DTAPNT
	D = -(FLOAT(DTAPNT-1)/6.0)
	RETURN
	END
	REAL FUNCTION S(PT)
	INTEGER PT,MAXRNG,MAXPT
	COMMON/SCAL/ MAXRNG,MAXPT
	P2 = 0
	IF (PT .EQ. 0) GOTO 10
	P2 = FLOAT(MAXRNG)/FLOAT(PT)
	P2 = FLOAT(MAXPT)/P2
	IF (P2 .GT. FLOAT(MAXPT)) P2 = FLOAT(MAXPT)
10	S = P2
	RETURN
	END
	SUBROUTINE PLTFIN
	CALL PLOT(7.8,-10.,-3)
	RETURN
	END
	SUBROUTINE PLTGRH(I1)
	INCLUDE 'PLTSYS.PRM'
C
C	--GET STARTING COORD
C
	I = 1
20	IF (A(I1,I) .NE. -80) GOTO 10
	I = I+1
	GOTO 20
10	IF (I .GE. 49) RETURN
C
C	--PLOT FIRST POINT
C
	CALL PLOT(S(A(I1,I)),D(I),3)
C
C	--PLOT GRAPH
C
	MODE = 2
	DO 30 I = I,49
	J = I
	IF (A(I1,J) .LT. 0) GOTO 40
	CALL PLOT(S(A(I1,J)),D(J+1),MODE)
	IF (MODE .EQ. 3) MODE = 2
	GOTO 30
40	MODE = 3
30	CONTINUE
C
C	--FINISH
C
	CALL PLOT(0.,0.,3)
	RETURN
	END
	SUBROUTINE SETSCL(MAXR,MAXP)
	INTEGER MAXRNG,MAXPT,MAXR,MAXP
	COMMON/SCAL/ MAXRNG,MAXPT
	MAXRNG = MAXR
	MAXPT = MAXP
	RETURN
	END
	SUBROUTINE PLTTL(ASC,NUMDIG)
	INCLUDE 'PLTSYS.PRM'
	DOUBLE PRECISION DPX
	INTEGER ASC(10)
	DIMENSION MONTH(12)
	DATA MONTH/'JAN','FEB','MAR','APR','MAY','JUN','JUL'
	1,'AUG','SEP','OCT','NOV','DEC'/
C
C	--MAKE TIME LINE AND SET UP FOR PLOT
C
100	FORMAT(' ',I5)
	CALL PLOT(0.,9.5,-3)
	CALL PLOT(0.,-8.,2)
	CALL PLOT(5.,0.,3)
	CALL PLOT(0.,0.,2)
	X = 0.
	DO 10 I = 1,24
	CALL PLOT(0.,X,3)
	CALL PLOT(.1,X,2)
	CALL PLOT(-.1,X,2)
	J = I
	CALL NUMBER(-.3,X,.1,FLOAT(J-1),-90.,-1)
	X = X-.333333
10	CONTINUE
	CALL SYMBOL(-1.,-.75,.25,ASC,-90.,NUMDIG)
C
C	--MAKE DATE
C
	IYER = IPLTST(1)-1900
	ENCODE(9,20,DPX) IPLTST(3),MONTH(IPLTST(2)),IYER
20	FORMAT(I2,'-',A3,'-',I2)
	CALL SYMBOL(-1.5,-.75,.15,DPX,-90.,9)
	CALL PLOT(0.,0.,3)
	RETURN
	END
	SUBROUTINE PLTDSK(I1,I2)
	INCLUDE 'PLTSYS.PRM'
C
C	--GET STARTING COORD
C
	I = 1
20	IF (B(I2,I1,I) .NE. -2) GOTO 10
	I = I+1
	GOTO 20
10	IF (I .GE. 49) RETURN
C
C	--PLOT FIRST POINT
C
	CALL PLOT(S(B(I2,I1,I)),D(I),3)
	CALL PLOT(S(B(I2,I1,I)),D(I+1),2)
C
C	--PLOT GRAPH
C
	MODE = 2
	DO 30 I = I,49
	J = I
	IF (B(I2,I1,J) .LT. 0) GOTO 40
	CALL PLOT(S(B(I2,I1,J)),D(J),MODE)
	CALL PLOT(S(B(I2,I1,J)),D(J+1),MODE)
	IF (MODE .EQ. 3) MODE = 2
	GOTO 30
40	MODE = 3
30	CONTINUE
C
C	--FINISH
C
	CALL PLOT(0.,0.,3)
	RETURN
	END
	SUBROUTINE PLKIO
	INCLUDE 'PLTSYS.PRM'
C
C	--PLOT DISK I/O'S
C
	CALL PLTTL('TIME VS DISK I/O''S',18)
	CALL SETSCL(500000,5)
	CALL SCL
	DO 10 II = 1,NUMDSK
	IJ = II
	CALL PLTDSK(8,IJ)
10	CONTINUE
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLKFUL
C
C	--PLOT DISK % OF FULLNESS FOR ALL FOUR PACKS
C
	CALL PLTTL('TIME VS % FULL ON RPA0',22)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTDSK(1,1)
	CALL PLTFIN
C
	CALL PLTTL('TIME VS % FULL ON RPA1',22)
	CALL SCL
	CALL PLTDSK(1,2)
	CALL PLTFIN
C
	CALL PLTTL('TIME VS % FULL ON RPA2',22)
	CALL SCL
	CALL PLTDSK(1,3)
	CALL PLTFIN
C
	CALL PLTTL('TIME VS % FULL ON RPA3',22)
	CALL SCL
	CALL PLTDSK(1,4)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTJSZ
C
C	--PLOT AVERAGE JOB SIZE (PAGES FOR KI,KL)
C
	CALL PLTTL('AVE JOB SIZE (P)',16)
	CALL SETSCL(40,5)
	CALL SCL
	CALL PLTBLK(16)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTPSN
C
C	--PLOT % SWAPPER NULL
C
	CALL PLTTL('% SWAPPER NULL',14)
	CALL SETSCL(100,5)
	CALL SCL
	CALL PLTBLK(15)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTRPS
C
C	--PLOT NUMBER OF REQUEUES PER SECOND
C
	CALL PLTTL('REQUEUES PER SECOND',19)
	CALL SETSCL(80,5)
	CALL SCL
	CALL PLTBLK(10)
	CALL PLTFIN
	RETURN
	END
	SUBROUTINE PLTJOO
C
C	--PLOT JOBS RUN OUT OF ORDER
C
	CALL PLTTL('JOBS RUN OUT OF ORDER',21)
	CALL SETSCL(600,5)
	CALL SCL
	CALL PLTBLK(8)
	CALL PLTFIN
	RETURN
	END

