PROGRAM TASK C C To read the task summary created by Datatrieve C C B. Z. Lederman 30-Mar-84 C 06-Apr-84 change fill pattern C 04-Sep-84 output to file, plotter, add sample lines C 05-Sep-84 Increase number of tasks C 09-Oct-84 Change fill when plotting C 06-Dec-84 more tasks and cut least used C 10-Jan-85 Slow plot output option C 20-Feb-85 Option to do both at once C IMPLICIT INTEGER (A-F, H-X) PARAMETER NBRTSK = 240 C INCLUDE '[001005]CGL.FTN/NOLIST' C REAL*8 TASKS, TASKV VIRTUAL TASKS(NBRTSK), TASKV(NBRTSK) VIRTUAL YD(NBRTSK, 7), YS(NBRTSK, 7) REAL A, B, C, D, A2, D2, AL, AR, DX, DY1, DY2, SCALE(6) REAL DATAIN(7), MAX(7), MIN(7), BOXX(4), BOXY(4) REAL*8 TSKNAM, TOTL, AVRG, IDENT(2, 6) INTEGER*4 GH, TI, OUTF INTEGER*2 SAVCOL(24), MOVCOL(24), RUNS, PRI, FILL(4), LINE(4) LOGICAL TOTAL, FIRST, PRINT, PLOT, FILE, REJCT, SLOW, BOTH BYTE ANS, MAXVAL(9), DATE(9), SAVDAT(9), INPFIL(32), OUTFIL(32) C EQUIVALENCE (OUTFIL(1), OUTF) C DATA TOTL, AVRG / 'Totals ', 'Averages' / DATA IDENT / 'CPU Tics', ' ', 'Directiv', 'es ', 1 'QIOs ',' ', 'Context ','Loads ', 2 'Checkpoi','nts ', 'Overlays',' ' / DATA INPFIL, OUTFIL, OUTLEN / 32 * 0, 32 * 0, 0 / DATA TI, GH, MAX, MIN, A / 'TI:', 'GH:', 7 * 0., 7 * 0., 0. / DATA FILL, LINE / 84, 68, 81, 67, 3, 4, 7, 5 / DATA MOVCOL / 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 3, 7, 1 7, 7, 0, 0, 7, 6, 7, 0, 6, 7, 7, 6 / DATA SAVCOL / 0, 0, 0, 0, 0, 7, 0, 7, 0, 7, 0, 0, 1 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 / C TOTAL = .TRUE. FIRST = .TRUE. PRINT = .FALSE. REJCT = .FALSE. PLOT = .FALSE. FILE = .FALSE. SLOW = .FALSE. BOTH = .FALSE. C WRITE (5, 30) 30 FORMAT('$ Enter data file name: ') READ (5, 40, END = 999) J, INPFIL 40 FORMAT( Q, 32A1) IF (J .LT. 32) J = J + 1 INPFIL(J) = 0 OPEN (UNIT = 1, NAME = INPFIL, TYPE = 'OLD', 1 READONLY) C 5 WRITE (5, 10) 10 FORMAT('$ Totals, Averages, or Both [T/A/B]: ') READ (5, 15, END = 999) ANS 15 FORMAT(A1) IF (ANS .NE. 'T' .AND. ANS .NE. 't' .AND. ANS .NE. 'A' 1 .AND. ANS .NE. 'a' .AND. ANS .NE. 'B' .AND. 2 ANS .NE. 'b') GOTO 5 IF (ANS .EQ. 'B' .OR. ANS .EQ. 'b') BOTH = .TRUE. IF (ANS .EQ. 'A' .OR. ANS .EQ. 'a') TOTAL = .FALSE. C WRITE (5, 18) 18 FORMAT('$ Skip least used tasks [Y/N] ? ') READ (5, 15, END = 999) ANS IF ((ANS .EQ. 'Y') .OR. (ANS .EQ. 'y')) THEN WRITE (5, 20) 20 FORMAT('$ Enter minimum percentage [0. to 100.] ') READ (5, 21, END = 999) A 21 FORMAT( F14.7) IF (A .LE. 0.) A = 0. IF (A .GT. 100.) A = 100. A = 0.01 * A REJCT = .TRUE. ENDIF C WRITE (5, 22) 22 FORMAT('$ Store graphic output in a file [Y/N] ? ') READ (5, 15, END = 999) ANS IF ((ANS .EQ. 'Y') .OR. (ANS .EQ. 'y')) THEN WRITE (5, 25) 25 FORMAT('$ Enter output file name: ') READ (5, 28, END = 999) OUTLEN, OUTFIL 28 FORMAT( Q, 32A1) FILE = .TRUE. GOTO 90 ENDIF C OUTLEN = 3 WRITE (5, 32) 32 FORMAT('$ Output directly to plotter [Y/N] ? ') READ (5, 15, END = 999) ANS IF ((ANS .EQ. 'S') .OR. (ANS .EQ. 's')) THEN SLOW = .TRUE. ! slow plot for film ANS = 'Y' ! also means plot ENDIF IF ((ANS .EQ. 'Y') .OR. (ANS .EQ. 'y')) THEN OUTF = GH PLOT = .TRUE. GOTO 90 ENDIF C OUTF = TI WRITE (5, 50) 50 FORMAT(' Output will be to video screen.' / 1 '$ Copy output to printer [Y/N] ? ') READ (5, 15, END = 999) ANS IF (ANS .EQ. 'Y' .OR. ANS .EQ. 'y') PRINT = .TRUE. C 90 T = 0 100 READ (1, 110, END = 200) TSKNAM, DATE, RUNS, PRI, DATAIN 110 FORMAT( A8, 3X, 9A1, 2X, I4, 1X, I3, 3( 1X, F9.0), 1 1X, 2( 1X, F9.0), 2(2X, F9.0) ) C IF (TSKNAM .LT. '......') GOTO 100 ! reject formfeeds, etc. IF (FIRST) THEN ! save date for later DO 105 I = 1, 9 105 SAVDAT(I) = DATE(I) FIRST = .FALSE. ENDIF T = T + 1 IF (T .GT. NBRTSK) GOTO 200 ! limit amount of data TASKV(T) = TSKNAM DO 120 J = 1, 7 ! copy data YD(T, J) = DATAIN(J) IF (J .EQ. 1) GOTO 120 ! finished for elapsed time IF (.NOT.TOTAL) THEN ! convert to averages IF (YD(T, 1) .LE. 2.) THEN ! skip low elapsed time YD(T, J) = 0. ELSE YD(T, J) = YD(T, J) / YD(T, 1) ! over elapsed time ENDIF ENDIF IF (YD(T, J) .GT. MAX(J)) MAX(J) = YD(T, J) ! record maximums 120 CONTINUE C GOTO 100 C 200 CLOSE (UNIT = 1) IF (PRINT) OPEN (UNIT = 1, FILE = 'TT2:FORMF.EED', TYPE = 'NEW') C 530 B = AMAX1( MAX(2), MAX(3), MAX(4), MAX(5)) ! only 4 items plotted DO 205 F = 2, 5 ! normalize data SCALE(F) = B / MAX(F) 205 MIN(F) = A * MAX(F) ! get acceptable minimums M = 0 DO 230 I = 1, T ! for all tasks IF (REJCT) THEN DO 210 F = 2, 5 IF (YD(I, F) .GT. MIN(F)) GOTO 220 ! if above minimum, OK 210 CONTINUE GOTO 230 ! not above minimum, reject ENDIF 220 M = M + 1 ! go to next slot TASKS(M) = TASKV(I) ! move task name DO 230 F = 2, 5 ! for all items YS(M, F) = SCALE(F) * YD(I, F) 230 CONTINUE C DY1 = 1.06 * B ! center of top for text DY2 = 1.06 * DY1 B = 1.06 * DY2 ! put margin at top D = -0.1 * B ! space for task names D2 = 0.5 * D ! center task names C CALL CGL (GIC) ! Initialize Core CALL CGL (GIVS, OUTFIL, OUTLEN) ! Initialize Surface CALL CGL (GSVS, OUTFIL, OUTLEN) ! Select Surface IF (FILE .OR. PLOT) CALL CGL (GDVS, 'TI:', 3) ! De-Select video screen CALL CGL (GNF) ! New Frame C CALL CGL (GICM, SAVCOL) ! Save preset colors CALL CGL (GSCM, MOVCOL) ! First set of colors CALL CGL (GSW, -0.4, 79.6, D, B) ! Set window CALL CGL (GSO, 0) ! Set origin to bottom left CALL CGL (GSCJ, 1, 2) ! justify left, center IF (SLOW) CALL CGL (GSBI, 8) ! slow plot by setting bkgrnd C F = 0 DO 450 J = 0, (NBRTSK-10), 10 ! display 10 at a time F = F + 1 ! frame counter IF (J .GT. M) GOTO 500 ! but may not have all tasks IF (PLOT) THEN WRITE (5, 830) 830 FORMAT('$ Insert paper, then press Return or Enter.') READ (5, 15, END = 550) ANS ENDIF IF (FILE .OR. PLOT) CALL CGL (GBB) ! begin batch CALL CGL (GSWI, 7) ! write index white CALL CGL (GSFM, 0) ! fill mode no fill CALL CGL (GSLS, 1, 0, 0) ! set line type solid CALL CGL (GMA2, -0.4, 0.) ! Move to origin CALL CGL (GRA2, 79.6, B) ! Draw box around window CALL CGL (GSFM, 4) ! fill mode poly C DO 360 I = 1, 4 ! for each datum type CALL CGL (GSWI, I) ! set color BOXY(1) = 0 ! Bottom edge of box BOXY(4) = 0 ! is constant C DO 300 N = 1, 10 ! 10 tasks per display P = J + N ! offset for actual task IF (P .GT. M) GOTO 350 ! limit to number actually read A2 = (N - 1) * 8. ! base x position BOXX(1) = A2 + I ! left edge of bar BOXX(2) = BOXX(1) BOXX(3) = BOXX(1) + 0.8 ! right edge of bar BOXX(4) = BOXX(3) Q = I + 1 ! items 2 to 5 used BOXY(2) = YS(P, Q) ! height of bar BOXY(3) = BOXY(2) CALL CGL (GSWI, I) ! write index color Q = LINE(I) ! table of line types IF (PLOT) THEN CALL CGL (GSLS, 1, 0, 0) ! set line solid when plotting CALL CGL (GSFM, 0) ! fill mode no fill ELSE CALL CGL (GSLS, Q, 0, 0) ! set line type ENDIF CCCC Q = FILL(I) ! fill with letters (old) CALL CGL (GPGA2, BOXX, BOXY, 4) ! draw the bar 300 CALL CGL (GSFE, BOXX(2), BOXY(2)) ! fill the bar C 350 BOXY(1) = DY1 ! Bottom of box BOXY(4) = DY1 ! fixed BOXY(2) = B ! Top of box BOXY(3) = B ! also fixed DX = I * 16. ! horizontal position BOXX(1) = DX - 1.3 ! Left edge of sample BOXX(2) = BOXX(1) ! ditto BOXX(3) = DX - 0.5 ! Right edge of sample BOXX(4) = BOXX(3) ! ditto CALL CGL (GPGA2, BOXX, BOXY, 4) ! draw the sample CALL CGL (GSFE, BOXX(2), BOXY(2)) ! fill the sample C CALL CGL (GMA2, DX, DY2) ! position for legend CALL CGL (GT, IDENT(1, I), 14) ! write legend CALL CGL (GMA2, DX, DY1) ! position for max Q = I + 1 ENCODE ( 9, 355, MAXVAL) MAX(Q) ! encode maximum value 355 FORMAT ( F9.0) 360 CALL CGL (GT, MAXVAL, 9) ! and write it out C CALL CGL (GSWI, 7) ! write index white C DO 400 N = 1, 10 ! 10 tasks per display P = J + N ! offset for actual task IF (P .GT. M) GOTO 410 ! limit to number actually read A2 = (N - 1) * 8. ! base x position CALL CGL (GMA2, A2, D2) ! position for task name TSKNAM = TASKS(P) ! move name from virtual 400 CALL CGL (GT, TSKNAM, 6) ! write task name C 410 CALL CGL (GMA2, 0., DY2) ! move to upper left corner IF (TOTAL) THEN ! identify as totals CALL CGL (GT, TOTL, 8) ELSE ! or as averages CALL CGL (GT, AVRG, 8) ENDIF CALL CGL (GMA2, 0., DY1) ! just below CALL CGL (GT, SAVDAT, 9) ! write date IF (PRINT) THEN ! check top of page N = F - 1 IF (IMOD( N, 3) .EQ. 0) WRITE (1, 505) ! formfeed 505 FORMAT( '1' ) CALL CGL (GPS, -0.4, 79.6, D, B, 0., 0.) ! print C ELSE IF (FILE .OR. PLOT) THEN IF (PLOT) CALL CGL (GMA2, -0.4, B) ! move to upper left CALL CGL (GEB) ! end batch WRITE (5, 820) F 820 FORMAT(' Finished frame ', I3) C ELSE CALL CGL (GCW, 8.) ! Wait ENDIF CALL CGL (GNF) ! New Frame 450 CONTINUE C 500 IF (.NOT. BOTH) GOTO 550 ! don't repeat C DO 540 J = 2, 7 ! for existing data MAX(J) = 0. ! reset maximums DO 540 M = 1, T ! for each task IF (YD(M, 1) .LE. 2.) THEN ! skip low elapsed time YD(M, J) = 0. ELSE YD(M, J) = YD(M, J) / YD(M, 1) ! convert total to averages ENDIF IF (YD(M, J) .GT. MAX(J)) MAX(J) = YD(M, J) ! record maximums 540 CONTINUE TOTAL = .FALSE. ! now it's averages BOTH = .FALSE. ! so we don't do this twice GOTO 530 ! go back and repeat plot C 550 CONTINUE CALL CGL (GSCM, SAVCOL) ! Put original colors back CALL CGL (GNF) ! New Frame CALL CGL (GDVS, OUTFIL, OUTLEN) ! De-Select view surface CALL CGL (GTVS, OUTFIL, OUTLEN) ! Terminate view surface CALL CGL (GTC) ! Terminate Core 999 CALL EXIT END