Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/21/fqclst.sim
There is 1 other file named fqclst.sim in the archive. Click here to see a list.
! Programmed by Stefan Arnborg FOA
! Modified by Mats Ohlin FOA 770727, 770805, 780728 (try TMP:SVC + PIP)
;
OPTIONS(/-Q/-A/-I/-D);
BEGIN
    EXTERNAL PROCEDURE exit,run;
    EXTERNAL BOOLEAN PROCEDURE tmpout;
    EXTERNAL TEXT PROCEDURE inline,storbokstav,scanto,
    tmpnam,tmpin,skip,conc;
    EXTERNAL REF(Infile) PROCEDURE findinfile;
    EXTERNAL INTEGER PROCEDURE input;
    PROCEDURE fileerror(tx,tfile);  NAME tx;  TEXT tx,tfile;
    BEGIN
	Outimage;
	Outtext("Have you really executed FQCRED?");
	Outimage;
	Outtext("I cannot find the corresponding ");
	Outtext(tx);   Outtext(" file:");
	Outimage;
	Outtext(tfile);
	Outimage;
	Outtext("Type HELP FQC for help.");
	Outimage;
	GO TO inl;
    END file error;
    REF(Infile) fqd,fqs;   BOOLEAN seqtrace;
    TEXT tt1,tt2,tt3;
    INTEGER bound;
    Outtext("Welcome to FQCLST Version 3");   Outimage;
    tt1:- tmpin("SVC",FALSE);  scanto(tt1,' ');
    tt1:- scanto(tt1,'.');
    WHILE tt1==NOTEXT DO
    inl:   tt1:-inline("Program:",Sysin);
    IF tt1.Getchar = '?' THEN
    BEGIN
	Outimage;
	Outtext("This program will merge the edited file created");
	Outimage;
	Outtext("by FQCRED with the frequency file.");
	Outimage;
	Outtext("Enter the same filename you entered to FQCRED.");
	Outimage;
	Outimage;
	GOTO inl;
    END ELSE tt1.Setpos(1);
    storbokstav(tt1);
    tt2:-scanto(tt1,'[');   bound:=tt1.Pos;
    IF bound>tt1.Length THEN
    BEGIN
	tt1.Setpos(1);
	tt3:-scanto(tt1,'.');
	IF bound>tt1.Pos THEN
	tt2:-tt3;
    END;
    bound:=tt2.Length+3;   tt1:-Blanks(bound+1);
    tt1:=tt2;
    tt1.Sub(bound-2,4):=".FQD";    tt2:-Copy(tt1);
    tt2.Sub(bound+1,1):="S";    tt3:-copy(tt1);
    fqd:-findinfile(tt1);
    IF fqd==NONE THEN fileerror("edited",tt1);
    tt3.Sub(tt3.length,1):= "T";
    INSPECT findinfile(tt3) ! .FQT; DO
    BEGIN   Open(NOTEXT);  Close;   seqtrace:= TRUE  END;
    fqs:-findinfile(tt2);
    IF fqs==NONE THEN
    BEGIN
	IF seqtrace THEN
	BEGIN   bound:= 5000;
	    Outtext("%Trying to process without .FQS file");
	    Outimage;   GO TO run_
	END;
	fileerror("frequency",tt2);
    END;
    fqs.Open(NOTEXT);
    ! Note - side effect - BOUND read from FQS;
    IF input(fqs,bound) < 5 OR bound < 1 OR bound > 80000 THEN
    fqserror:
    BEGIN   Outtext("? Something wrong with .FQS file.");
	Outimage;   exit(0);
    END error in .FQS;
    run_:
    tt3.Sub(tt3.Length,1):="L";
    INSPECT NEW Outfile(tt3) DO
    BEGIN	INSPECT fqd DO
	BEGIN REF(Infile)s;
	    TEXT i,tfront;
	    INTEGER imlen,f,p1,p2,l,sz,j,ntab,oldtab,nb,oldnb,trcpos;
	    REAL tot_time;
	    CHARACTER ch,cbar;
	    INTEGER max,tmax,fsum,seqpos;
	    INTEGER ARRAY frequency[0:bound];   ARRAY z_time[-1:100];

	    IF fqs =/= NONE THEN
	    BEGIN
		IF input(fqs,frequency,z_time)
		<= 5*(bound+102) THEN GO TO fqserror;
		fqs.Close;
	    END;
	    cbar:='|';
	    oldnb:= nb:= 1;
	    imlen:=135;
	    THIS Infile.Open(Blanks(imlen));
	    Lastitem;
	    ch:=Inchar;
	    seqpos:= IF Digit(ch) THEN 6 ELSE 1;
	    trcpos:= IF seqtrace THEN 17 ELSE 9;
	    THIS Outfile.Open(Blanks(imlen+trcpos));
	    IF seqtrace THEN
	    Outtext("Point no ");
	    Outtext(" Max   --------------------- FQC Result ---------------------");
	    Outimage;   Outimage;
	    i:-Image;
	    WHILE NOT Endfile DO
	    BEGIN
		IF ch NE cbar THEN
		BEGIN   IF THIS Outfile.Pos>1 THEN Outimage;
		    IF seqtrace THEN THIS Outfile.Setpos(7);
		    IF max NE 0 THEN Outint(max,6);
		    THIS Outfile.Setpos(trcpos);
		    IF max>tmax THEN tmax:=max;
		    IF ch = ' ' THEN
		    BEGIN   i.Setpos(seqpos);
			FOR oldtab:= 1 STEP 1 UNTIL ntab DO
			i.Putchar(Char(9));
			IF seqtrace THEN
			BEGIN  THIS Outfile.Setpos(1);   Outint(oldnb,5);
			    oldnb:= nb;   THIS Outfile.Setpos(trcpos);
			END;
		    END ch blank;
		    Outtext(i.Strip); Outimage;
		    Inimage;
		    Setpos(seqpos);   Lastitem;
		    WHILE Pos < seqpos DO
		    BEGIN   Setpos(seqpos);   Lastitem  END skip lsn;
		    ch:=Inchar;
		    IF ch NE cbar THEN
		    BEGIN
			tfront:- Image.Sub(seqpos,Pos-1);
			skip(tfront,Char(9));
			ntab:= tfront.Pos-1;
		    END;
		    max:=0;
		END ELSE
		BEGIN   p1:=THIS Infile.Pos;j:=j+1;
		    nb:= nb + 1;
		    IF j > bound THEN
		    BEGIN   Outtext("? Frequency excess.");
			Outimage;
			Outtext("Files .FQD and .FQS does not match.");
			Outimage;   exit(0);   GO TO final
		    END;
		    f:=frequency[j]; ch:=Inchar;
		    fsum:=fsum+f;
		    IF f>max THEN max:=f;
		    IF ch NE cbar THEN
		    BEGIN   Scanto(Image,cbar);
			IF NOT More THEN Setpos(imlen-2) ELSE ch:= cbar;
		    END;
		    p2:=THIS Infile.Pos-1;
		    l:=p2-p1;
		    IF l>8 THEN l:=8;
		    sz:=IF f=0 THEN 0 ELSE
		    IF f<10 THEN 1 ELSE
		    IF f<100 THEN 2 ELSE
		    IF f<1000 THEN 3 ELSE
		    IF f<10000 THEN 4 ELSE
		    IF f<100000 THEN 5 ELSE
		    IF f<1000000 THEN 6 ELSE
		    IF f<10000000 THEN 7 ELSE 8
		    ;
		    IF sz=0 THEN
		    BEGIN
			i.Setpos(p1);
			WHILE i.Pos<p1+l DO i.Putchar('-');
		    END ELSE
		    IF sz>l THEN
		    BEGIN
			i.Setpos(p1);
			WHILE i.Pos<p1+l DO i.Putchar('*');
			IF THIS Outfile.Pos = 1 THEN THIS Outfile.Setpos(trcpos);
			p1:= p1+trcpos+ntab*7-seqpos;
			IF p1 <= THIS Outfile.Pos THEN p1:= THIS Outfile.Pos+1;
			THIS Outfile.Setpos(p1);   Outint(f,sz);
		    END ELSE i.Sub(p1,sz).Putint(f);
		END
	    END;
	    Outimage;
	    Outtext("FQC results:");   Outimage;
	    Outtext("Max frequency:"); Outint(tmax,10);   Outimage;
	    Outtext("Sum frequency:"); Outint(fsum,10);   Outimage;
	    Outtext("No. of executions:");   Outint(frequency[0],6);
	    Outimage;
	    IF j NE bound AND frequency[0]>0 THEN
	    final:
	    BEGIN   Outtext("%Editing out of phase.");
		Outint(bound-j,6);   Outtext(" missing '|'");
		Outimage;
	    END error;
	    FOR j:= 1 STEP 1 UNTIL 100 DO
	    IF z_time[j] > 0 THEN GO TO print;
	    IF FALSE THEN
	    print:
	    BEGIN   Outimage;
		tot_time:= z_time[0] - z_time[-1];
		Outtext("CPU timing: Total");   Outfix(tot_time,2,7);
		Outtext(" sec.");   Outimage;
		IF frequency[0]>1 THEN
		BEGIN   THIS Outfile.Setpos(13);   Outtext("Mean  ");
		    Outfix(tot_time/frequency[0],2,8);
		    Outtext(" sec.");   Outimage;
		END;
		Outimage;
		Outtext("Call no.    Time spent    % of runtime");   Outimage;
		tot_time:=tot_time*0.01;
		FOR j:= 1 STEP 1 UNTIL 100 DO
		IF z_time[j] > 0 THEN
		BEGIN   Outint(j,5);   Outfix(z_time[j],3,15);
		    Outfix(z_time[j]/tot_time,2,15);   Outimage;
		END j;
	    END print;
	    Close;
	END of infile;
	Close;
    END outfile;
    Outchar(Char(7));
    Outimage;
    Outtext("Result on file: DSK:");Outtext(tt3);
    IF seqtrace THEN Outtext(" and .FQT");
    Outtext(" - Type CON to see them at once.");
    Outimage;
    exit(0);
    tmpout("PIP",
    IF seqtrace THEN conc("TTY:=",tt3,",",tt3.Sub(1,tt3.Length-1),"T")
    ELSE conc("TTY:=",tt3));
    run("SYS:PIP",2);
END program FQCLST