Listing of file='@HITRATE' on disk='vmedia/mvp-cs386-1.30-disk2.wvd.zip'
# Sector 1342, program filename = '@HITRATE' 0010 REM ! @HITRATE 08/16/88 - DS CACHE USAGE ANALYSIS UTILITY : REM ! (c) Copyright, Wang Laboratories, Inc., 1987. All rights reserved. 0020 REM %variables : DIM E1$(6)4,N(6),A$2,A1$2,N1(6),E$(18)2,B$3,B1$3,Q$1,T$80,M1$50,M2$50 : STR(G$,1,1)=HEX(20) : STR(F$,1,1)=HEX(30) 0030 REM %screen 1 : SELECT PRINT 005(80) : PRINT HEX(0D030202000F020402000F); 0040 T$="D S C a c h e U s a g e" : PRINT AT(0,40-LEN(T$)/2);T$; 0050 GOSUB '50("(c) Copyright, Wang Laboratories, Inc., 1987"," All rights reserved.") 0060 PRINT AT(23,61);"FN/TAB - Exit";AT(22,61);"RETURN - Proceed"; 0065 B$="D10" 0070 REM %get DS address : PRINT AT(3,16);"Base address of DS unit (D10, D20, or D30): "; : LINPUT HEX(0E),-B$ : IF B$="RUN"THEN 65 : PRINT HEX(06); : GOSUB '50(" "," ") : $TRAN(B$,"DdBb")R : IF POS("DB"=STR(B$,1,1))<>0 AND POS("123"=STR(B$,2,1))<>0 AND STR(B$,3,1) ="0" THEN 80 : GOSUB '50(HEX(0E),"Illegal address") : GOTO 70 0080 B1$=B$ : STR(B1$,2,1)=ADDC HEX(04) : SELECT #2 <B1$> : ERRORGOSUB '50(HEX(0E),"Invalid address") : GOTO 70 0090 REM %get DS status : GOSUB '50(HEX(0E),"Getting device status") : STR(F$,2,6)=ALL(00) : E$()=ALL(20) : $GIO STATUS REQUEST #2 (0E14 0F00 12E2 0600 0700 70A0 4002 88D0 7040 6A10 6816 4000 8705 1A00 C340, F$)F$;STR(E$(),,VAL(STR(F$,5,1))) : S,S1=VAL(STR(E$(),6,2),2)*256+VAL(STR(E$(),8,1)) 0100 STR(F$,8,1)=AND HEX(10) : IF STR(F$,8,1)=HEX(00) THEN 110 : GOSUB '50(HEX(0E),"Disk unavailable") : GOTO 70 0110 IF STR(E$(),1,1)=HEX(33)THEN 120 : GOSUB '50(HEX(0E),"Specified disk is not a DS") : GOTO 70 0120 GOSUB '50(" "," ") 0130 REM %screen 2 : REM initialize bar graph : GOSUB '100(10,15,0) 0140 PRINT AT(5,0,);AT(21,56);"ERASE - Clear counts";AT(22,55);"RETURN - Resta rt program"; AT(23,55);"FN/TAB - Exit"; 0150 PRINT AT(5,09);BOX(9,62);HEX(0E);" Disk / Cache usage";HEX(0F);AT(15,09); BOX(5,62);HEX(0E);" RAM Disk usage";HEX(0F); 0160 MAT N1=ZER : MAT N=ZER 0170 REM %get counts : STR(G$,2,6)=ALL(00) : $GIO GET HIT RATES #2 (0600 0700 70A0 4002 88D0 7040 6A10 6826 4000 8705 1A00 C340, G$)G$;STR(E1$(),,VAL(STR(G$,5,1))) 0180 STR(F$,2,6)=ALL(00) : $GIO STATUS REQUEST #2 (0600 0700 70A0 4002 88D0 7040 6A10 6816 4000 8705 1A00 C340, F$)F$;STR(E$(),,VAL(STR(F$,5,1))) : S=VAL(STR(E$(),6,2),2)*256+VAL(STR(E$(),8,1)) 0190 IF S=S1 THEN 200 : GOSUB '50("RAM Disk size changed","Press ERASE to clear counts") : KEYIN Q$ : GOTO 320 0200 FOR N = 1 TO 6 : A$=STR(E1$(N),2,1)&STR(E1$(N),1,1) : A1$=STR(E1$(N),4,1)&STR(E1$(N),3,1) : N(N) = VAL(A$,2)+( VAL(A1$,2)*65536) : N1(N)=N1(N)+N(N) : NEXT N 0210 IF N1(2)+N1(4) <= N1(1)+N1(3) THEN 220 : GOSUB '50("Count conflict","Press SF'0 to clear counts") : KEYIN Q$ : GOTO 320 0220 REM %diplay counts 0230 PRINT AT(6,16);"Total number of sectors read: ";N1(1) 0240 PRINT AT(7,34);"from cache: ";N1(2) 0250 PRINT AT(8,35);"from disk: ";N1(1)-N1(2) 0260 PRINT AT(13,13);"Total number of sectors written: ";N1(3) 0270 PRINT AT(16,13);" Total number of sectors read: ";N1(5) 0280 PRINT AT(17,13);"Total number of sectors written: ";N1(6) 0290 SELECT P9 : PRINT AT(19,15);"Number of sectors in RAM Disk: ";S : SELECT P0 0300 IF N1(1)=0 THEN P=0 : ELSE P=ROUND((N1(2)/N1(1)*100,1) : GOSUB '100(R,C,P) : PRINT AT(11,30);"Cache hit rate: ";P;"% "; 0310 REM %wait, then repeat : KEYIN Q$,320,330 : GOTO 170 0320 ON POS(HEX(E50D)=Q$) GOTO 90,10 : GOTO 170 0330 ON POS(HEX(487E7F)=Q$) GOTO 90,360,360 : GOTO 170 0340 REM %exit 0350 DEFFN'127 0360 DEFFN'126 : LOAD RUN "@MENU" 0370 REM %'100 - display bar 0380 DEFFN'100(R,C,P) : P=INT(P) : IF P<>0 THEN 390 : PRINT HEX(0202020F06);AT(R,C,51);BOX(1,50); : P1=0 0390 ON SGN(P-P1)+2 GOTO 400,430,410 0400 IF MOD(P1,2)=0 THEN PRINT AT(R,C+P1/2);HEX(20); : ELSE PRINT AT(R,C+P1/2);HEX(D5); : P1=P1-1 : GOTO 390 0410 P1=P1+1 : IF P1<>1 THEN 420 : PRINT AT(R,C+P1/2);HEX(EA); : GOTO 390 0420 IF MOD(P1,2)=0 THEN PRINT AT(R,C+P1/2);HEX(D5); : ELSE PRINT AT(R,C+P1/2);HEX(FF); : GOTO 390 0430 RETURN 0440 DEFFN'50(M1$,M2$) : REM %'50 - display message at lower left corner (lines 22,23) : PRINT AT(22,0);STR(M1$);AT(23,0);STR(M2$);HEX(0F); : RETURN