Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/21/fqc.qlp
There is 1 other file named fqc.qlp in the archive. Click here to see a list.
00100	FQC - MEASUREMENT AND TRACING SYSTEM FOR SIMULA PROGRAMS
00200	========================================================
00300	
00400	If a SIMULA program has been developed which will be used very often,
00500	e.g.   as  a  part in a regularly used production system, it is often
00600	profitable to spend some efforts optimizing the program.
00700	
00800	A central and sometimes non-trivial problem in  program  optimization
00900	is  to  find  the  innermost loops of the program. Once the execution
01000	profile of a program is known it is usually easy to  make  it  faster
01100	with  a few changes such as modifications in processing algorithms or
01200	by using a small machine language subroutine.
01300	
01400	DEC-10 SIMULA is delivered with a frequency measurement system  which
01500	assists  in  spotting  frequently executed parts of a SIMULA program.
01600	The system consists of two SIMULA programs, FQCRED and FQCLST.
01700	
01800	The system is used as follows:
01900	
02000	The program to be analyzed must have been tested well enough  to  run
02100	to  normal  completion.   It  is  read  by  the  program FQCRED which
02200	produces two modified versions of it, one of which  is  a  compilable
02300	SIMULA  program  (.FQ1+.FQ2)  and  the  other a listing later used to
02400	produce  the  frequency  listing  (.FQD).   The  modified  compilable
02500	program  is  executed  (.FQR) and produces, if normally terminated, a
02600	file of measured frequencies (.FQS). This file  is  merged  with  the
02700	listing  output from FQCRED by the program FQCLST, which produces the
02800	final output (.FQL).
02900	
03000	The user may also measure the execution time for different  parts  of
03100	his  program by editing calls to a procedure Z_T(I) into his program.
03200	A call with I > 0 initiates a timing which is ended by  a  call  with
03300	the corresponding negative I. The logic is as follows:
03700	+100>=I>0  T0[I]:= cptime;
03800	-100<=I<0  J:=-I; ACC[J]:= ACC[J]+(cptime-T0[J]);
03900	Calls to Z_T may be overlapping (even partly).
04000	
04100	For example:
04200	
04300	BEGIN
04400		....
04500		Z_T(+1);------------+
04600		....                |
04700		Z_T(+2);---------+  |
04800		....             |  |
04900		Z_T(+3);------+  |  |
05000		....          |  |  |
05100		Z_T(-2);------)--+  |
05200		....          |     |
05300		Z_T(-3);------+     |
05400		....                |
05500		Z_T(-1);------------+
05600		....
05700	END
05800	
05900	The resulting CPU-times will be presented at the end  of  the  result
06000	file  (.FQL).  For  reliable results, do not try to measure too small
06100	intervalls (depending on the precision of the timing). Note that only
06200	such measurements that yielded accumulated times > 0 will be printed.
06400	
06500	The measured program should satisfy some restrictions:
06600	
06700	i)	The program must not contain the identifiers Z_Q, Z_T or Z__.
06800	
06900	ii)	The program should not use any files on DSK: named
07000		<program name>.FQ1 .FQ2 .FQR .FQD .FQS .FQL or .FQT.
07100	
07200	iii)	The program should terminate through its last END.
07300		I.e. not through call to Exit or through SIMDDT.
07400	
07500	iv)	The source code lines should preferably not contain
07600		any internal TABs (leading TABs are OK). If so, the
07700		produced frequency indicators (|) might be misplaced
07800		(within such a line). TABs may be removed with
07900		.COPY temp.sim=prog.sim(W).
08000	
08100	Note that the frequency indicators will be positioned  at  the  first
08200	position  of  the  symbol  counted.  Its  related  number  should  be
08300	interpreted as the number of times this symbol has been PASSED during
08400	the  execution. An indicated label (L:) will thus tell how many times
08500	control passed the label from left, excluding explicit jumps  (GO  TO
08600	L).
08700	
08800	By  adding the switch /T to the filespecification requested by FQCRED
08900	a trace file (.FQT) will be produced, containing the number  of  each
09000	executed  (counted)  statement.  This  may  be  useful when debugging
09100	Simulation programs or programs making use of resume/detach.  If  the
09200	program  terminates  with  an  error the file with logical name TRACE
09300	must be closed before leaving SIMDDT.
09400	
09600	The result file (.FQL) will contain information about the  number  of
09700	the  first traced statement on each source line. Consequetive numbers
09800	will be indicated as xx-yy in .FQT. Note that the file is created  in
09900	APPEND  mode adding new traces to the end of the file. The trace file
10000	will contain the first six characters of the traced  symbol  followed
10100	by its statement number.
10300	
10400	Adding a number to the trace switch (/T:x) will trace
10500	the executed statements the first x times. Every statement
10600	number will be displayed (no xx-yy compacting). X must be >= 0,
10700	/T:0 is equivalent to /T.
10800	
10900	The use of tracing will considerably increase the execution
11000	time of the modified program. Thus it is not recommended to
11100	use timing (Z_T) together with tracing. The tracing may be
11200	switched off by calling the procedure TRACEOFF. It may be
11300	activated again by calling TRACEON.
11400	
11500	
11600	If you want to include any of your external modules in the
11700	analysis, run the program SIMEXP prior to FQCRED.
11800	
11900	
12000	The following session illustrates the use of the system on the
12100	SIMULA program FLOPY.SIM.
12200	
12300	
12400		.run pub:fqcred
12500	
12600		Welcome to FQCRED Version 3
12700	
12800		Program:flopy
12900	
13000		[FQCRED: CPU time: 0.88]
13100		Running modified program: SIMULA:  FLOPY
13200		LINK:	Loading
13300		[LNKXCT FLOPY Execution]
13400	
13500		If you want to have the result at once type .CONTINUE
13600		To accumulate the frequencies just type: START
13700	
13800		.con
13900	
14000		Welcome to FQCLST Version 3
14100	
14200		Result on file: DSK: FLOPY.FQL - Type CON to see them at once.
14300	
14400		.con
14500	
14600		 Max   --------------------- FQC Result ---------------------
14700	
14800		        BEGIN COMMENT FREQUENCY MEASUREMENT EXAMPLE;
14900		            INTEGER u,k;   TEXT t;
15000		            z_t(+1);
15100		     1      |1
15200		            WHILE Draw(0.999,u) DO u:= u+2;
15300		  1636      |1                     |1636
15400		            z_t(-1);
15500		     1      |1
15600		            z_t(+2);
15700		     1      |1
15800		            FOR u:= 1 STEP 1 UNTIL 5000 DO
15900		     1      |1
16000		            IF t = NOTEXT THEN k:=k+1;
16100		  5000      |5000              |5000
16200		            z_t(-2);
16300		     1      |1
16400		            z_t(+3);
16500		     1      |1
16600		            FOR u:= 1 STEP 1 UNTIL 5000 DO
16700		     1      |1
16800		            IF t == NOTEXT THEN k:=k+1;
16900		  5000      |5000               |5000
17000		            z_t(-3);
17100		     1      |1
17200		            z_t(+4);
17300		     1      |1
17400		            FOR u:= 1 STEP 1 UNTIL 5000 DO
17500		     1      |1
17600		            IF TRUE THEN k:=k+1;
17700		  5000      |5000        |5000
17800		            z_t(-4);
17900		     1      |1
18000		        END;
18100		     1  |1
18200	
18300		FQC results:
18400		Max frequency:      5000
18500		Sum frequency:     31649
18600		No. of executions:     1
18700	
18800		CPU timing: Total   0.50 sec.
18900	
19000		Call no.    Time spent    % of runtime
19100		    1          0.047           9.46
19200		    2          0.248          49.90
19300		    3          0.095          19.11
19400		    4          0.089          17.91
19500	
19600	
19700		.DIRECT flopy
19800	
19900		FLOPY	SIM     1  <057>   8-Aug-78   User program
20000		FLOPY	FQ1     4  <057>   8-Aug-78   Modif. file part 1
20100		FLOPY	FQ2     3  <057>   8-Aug-78   Modif. file part 2
20200		FLOPY	FQD     1  <057>   8-Aug-78   Edited file with bars (|)
20300		FLOPY	FQR    11  <057>   8-Aug-78   REL-file from FQ1+FQ2
20400		FLOPY	FQS     1  <057>   8-Aug-78   Frequency + timing data (binary)
20500		FLOPY	FQL     3  <057>   8-Aug-78   Result file (FQS+FQD)
20600	
20700	
20800	Cleaning up afterwards might be done with .DELETE *.FQ?
20900	
21000			[End of FQC.HLP 78-08-16 MO]