PROGRAM TSKSUM C C To read the task summary created by Datatrieve C C B. Z. Lederman 30-Mar-84 C IMPLICIT INTEGER (A-F, H-Z) PARAMETER NBRTSK = 30 INCLUDE '[001005]CGL.FTN/NOLIST' REAL A, B, C, D, A2, D2, AL, AR, DX, DY1, DY2, SCALE(6) REAL Y(NBRTSK, 7), DATAIN(7), MAX(7), BOXX(4), BOXY(4) REAL*8 TSKNAM, TASKS(NBRTSK), TOTL, AVRG, IDENT(2, 6) INTEGER*2 SAVCOL(24), MOVCOL(24), RUNS, PRI, FILL(4) LOGICAL TOTAL, FIRST, PRINT BYTE ANS, MAXVAL(9), DATE(9), SAVDAT(9), FILNAM(32) C DATA TOTL, AVRG / 'Totals ', 'Averages' / DATA IDENT / 'CPU Tics', ' ', 'Directiv', 'es ', 1 'QIOs ',' ', 'Context ','Loads ', 2 'Checkpoi','nts ', 'Overlays',' ' / DATA MAX, FILNAM / 7 * 0., 32 * 0 / DATA FILL / 84, 68, 81, 67 / DATA MOVCOL / 0, 0, 0, 0, 4, 6, 0, 7, 0, 7, 0, 0, 1 7, 7, 0, 0, 7, 6, 7, 0, 6, 7, 7, 6 / C TOTAL = .TRUE. FIRST = .TRUE. PRINT = .FALSE. WRITE (5, 30) 30 FORMAT('$ Enter data file name: ') READ (5, 40, END = 999) FILNAM 40 FORMAT(32A1) OPEN (UNIT = 1, NAME = FILNAM, TYPE = 'OLD', 1 READONLY) 5 WRITE (5, 10) 10 FORMAT('$ Totals or Averages [T/A]: ') READ (5, 20, END = 999) ANS 20 FORMAT(A1) IF (ANS .NE. 'T' .AND. ANS .NE. 't' .AND. ANS .NE. 'A' 1 .AND. ANS .NE. 'a') GOTO 5 IF (ANS .EQ. 'A' .OR. ANS .EQ. 'a') TOTAL = .FALSE. WRITE (5, 50) 50 FORMAT('$ Print hardcopy [Y/N]: ') READ (5, 20, END = 999) ANS IF (ANS .EQ. 'Y' .OR. ANS .EQ. 'y') PRINT = .TRUE. C T = 0 100 READ (1, 110, END = 200) TSKNAM, DATE, RUNS, PRI, DATAIN 110 FORMAT( A8, 4X, 9A1, 1X, I4, 1X, I3, 3( 1X, F9.0), 1 1X, 2( 1X, F9.0), 2(2X, F9.0) ) C IF (TSKNAM .LT. 'AAAAAA') 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 TASKS(T) = TSKNAM DO 120 J = 1, 7 ! copy data Y(T, J) = DATAIN(J) IF ((.NOT.TOTAL) .AND. (J .GT. 1)) THEN ! convert to averages IF (Y(T, 1) .LE. 2.) THEN ! skip low elapsed time Y(T, J) = 0. ELSE Y(T, J) = Y(T, J) / Y(T, 1) ! over elapsed time ENDIF ENDIF 120 IF (Y(T, J) .GT. MAX(J)) MAX(J) = Y(T, J) ! record maximums C D WRITE (5, 180) TSKNAM, DATE, (Y(T, J), J = 1, 7) D180 FORMAT(1X, A8, 1X, 9A1, 7(2X, F9.0)) C GOTO 100 C 200 CLOSE (UNIT = 1) C B = AMAX1( MAX(2), MAX(3), MAX(4), MAX(5)) ! only 4 items plotted DO 210 F = 2, 5 ! normalize data SCALE(F) = B / MAX(F) DO 210 I = 1, T 210 Y(I, F) = SCALE(F) * Y(I, F) 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 BOXY(1) = 0 ! this part of the box BOXY(4) = 0 ! never changes C CALL CGL (GIC) ! Initialize CALL CGL (GNF) ! New Frame 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 C DO 400 M = 0, 20, 10 ! need 3 displays for all tasks CALL CGL (GSWI, 7) ! write index white CALL CGL (GSO, 0) ! Set origin to bottom left CALL CGL (GSFM, 0) ! fill mode no fill 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 CALL CGL (GSCJ, 1, 2) ! justify left, center C DO 300 N = 1, 10 ! 10 tasks per display P = M + N ! offset for actual task IF (P .GT. T) GOTO 350 ! limit to number actually read A2 = (N - 1) * 8. ! base x position C DO 250 I = 1, 4 ! four datums per task BOXX(1) = A2 + I ! left edge of bar BOXX(2) = BOXX(1) BOXX(3) = BOXX(1) + 0.95 ! right edge of bar BOXX(4) = BOXX(3) Q = I + 1 ! items 2 to 5 used BOXY(2) = Y(P, Q) ! height of bar BOXY(3) = BOXY(2) CALL CGL (GSWI, Q) ! write index color Q = FILL(I) CALL CGL (GSFC, 0, Q, 1, 1) ! set fill character CALL CGL (GPGA2, BOXX, BOXY, 4) ! draw the bar 250 CALL CGL (GSFE, BOXX(2), BOXY(2)) ! fill the bar C CALL CGL (GSWI, 7) ! write index white CALL CGL (GMA2, A2, D2) ! position for task name 300 CALL CGL (GT, TASKS(P), 6) ! write task name C 350 DO 360 I = 1, 4 ! put in legend DX = I * 16. CALL CGL (GMA2, DX, DY2) ! position for legend Q = I + 1 CALL CGL (GSWI, Q) ! set color CALL CGL (GT, IDENT(1, I), 14) ! write legend CALL CGL (GMA2, DX, DY1) ! position for max 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 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 CALL CGL (GPS, -0.4, 79.6, D, B, 0., 0.) ! Set window ELSE CALL CGL (GCW, 5.) ! Wait ENDIF CALL CGL (GNF) ! New Frame 400 CONTINUE C CALL CGL (GSCM, SAVCOL) ! Put original colors back CALL CGL (GTC) ! Terminate 999 CALL EXIT END