MICRONOTES
================================================================================
Note 13.0                 MicroPower Run-time Perform.                No replies
JAWS::KAISER                                        254 lines  25-MAR-1985 09:20
--------------------------------------------------------------------------------
	+---------------+				     +-----------------+
	| d i g i t a l |				     |	uNOTE # 013    |
	+---------------+				     +-----------------+


	+----------------------------------------------------+-----------------+
	| Title: Run-time System Performance Evaluation	     | Date: 09-Oct-84 |
	|	    Using MicroPower/Pascal V 1.5	     |		       |
	+----------------------------------------------------+-----------------+
	| Originator: Herbert Maehner			     | Page 1 of 5     |
	+----------------------------------------------------+-----------------+



       In real-time programming, the performance of the	 run-time  system  and
       the compiler together govern the overall power of the application.  The
       performance of the  MicroPower/Pascal  compiler	has  been  extensively
       discussed by R.Billig/R.Cronk [1].

       The performance of  the	run-time  executive  of	 MicroPower/Pascal  is
       measured	 in  this  MicroNote using different LSI-11 CPU-boards and the
       KXT11-CA I/O processor.	 Data  was  obtained  using  MicroPower/Pascal
       version 1.5.

			       Test Conditions
			       ---------------

       Results obtained through a lab experiment are only as  precise  as  the
       test  environment  and  may  only  be  referenced giving the exact test
       conditions.

       The goal was to measure the elapsed time of a given primitive execution
       on  the Pascal process level, i.e.  how long it takes to call/execute a
       kernel primitive from a Pascal program.

       Generally, the following procedure was used to obtain the elapsed time,
       where  in  some	cases more than one output bit has been used to obtain
       the desired pulse-width.

		    WHILE Condition = TRUE DO
		    BEGIN
		      Out_port.bit0 := TRUE;

			{ here call/execute given primitive }

		      Out_port.bit0 := FALSE;
		    END;

       The whole test was done in a loop as long as the	 condition  was	 true.
       Here,  Condition	 is  a	boolean variable, which is set FALSE by a high
       priorty process waiting on a terminal input (READLN).

       The Outport.bit0 is bit0 of a parallel device.  The parallel device was
       either a DRV11 (using LSI 11/23 and LSI 11/73) or the on-board parallel
       device (using the FALCON plus SBC 11/21 and KXT11-CA).

									Page 2


       The bit0 pulse is used as the input to an oscilloscope  which  has  the
       capabilities  to	 measure and display time differences and frequencies.
       The elapsed  time  required  to	execute	 the  various  primitives  was
       obtained.   In  addition	 to the primitive requests some math-functions
       times were obtained.  The results are shown in Table 1 at the  of  this
       MicroNote.

			  Interrupt-Test Conditions
			  -------------------------

       A Pascal-program with  an  embedded  interrupt  service	routine	 needs
       DRIVER  privileges  in  a  mapped environment.  The test program either
       connects to a "normal" ISR or to a prio7 ISR.  The program  executed  a
       simple loop like:

		       WHILE TRUE DO
		       BEGIN
			Out_port.Bit1 := TRUE;
			Out_port.Bit1 := FALSE;
		       END;


       The Outport is the parallel device of the type mentioned	 above.	  This
       is  used	 to monitor process execution behavior.	 Testing the interrupt
       response time, we used a	 square	 wave  generator  which	 triggered  an
       interrupt on that parallel device.  The ISR was coded as

		    .ENABL  GBL		    ; Enable global symbols
		    .MCALL  MACDF$,PURE$    ; Set-up pure/impure area
		    .MCALL  IMPUR$

		    .GLOBL  INPORT,OUTPRT   ; port A,B of PPI

		    MACDF$		    ; MACDF$ must be called before the
		    PURE$		    ; two assembly directives

		    .DSABL AMA

	    PPIINT::
		    BISB    #1,@#OUTPRT	    ; set bit 0 output port   -------
		    MOVB    @#INPORT,@#Temp ; dummy read	       | ISR time
		    MOVB    @#INPORT,@#Temp ; dummy read	       | measured
		    BICB    #1,@#OUTPRT	    ; set bit 0 output port   -------
		    RTS	    PC		    ; normal ISR return
		    RTS	    R4		    ; prio 7 ISR return

		    IMPUR$
	    TEMP:   .WORD 0		    ; reserve one word
		    .END


       Depending upon the ISR-type either the RTS PC or the  RTS  R4  must  be
       used  to	 exit  the  ISR.   The	first  MACRO-statement	within the ISR
       signaled bit0 of the parallel port.  The resulting  interrupt  dispatch
       time  was defined as the pulse width given by the square wave generator

									Page 3


       edge and the signaled output port.   This  includes  the	 hardware  ISR
       dispatch	 time  as well.	 The ISR execution time was given by the pulse
       width indicated within  ISR  source  above.   Again,  all  pulses  were
       measured	 using	an  oscilloscope.   The	 maximum  interrupt  rate  was
       determined by increasing the square frequency (which in turn  increases
       the outpt square wave of the ISR) until the system lost interrupts.

       Using  CONNECT  SEMAPHORE  the  interrupt  performance  was   similarly
       measured.   In  this  case  only	 a  dynamic process was waiting on the
       semaphore to be signaled.  The results are shown in table 2.






	    References

	    1. Rich Billig and Randy Cronk, A System/Architecture Approach to
	       Microcomputer Benchmarking, DIGITAL Equipment Corporation,
	       Sept. 1982, EZ-12053-03/82

	    2. MicroPower/Pascal Newsletter, Volume 1, No. 1, March 1984, p. 23,
	       DIGITAL Equipment Corporation, Order Number AV-B067A-TK

									Page 4


	    +---------------+-----------+-----------+-----------+------+------+
	    |		    | LSI-11/23 | LSI-11/23 |		|      |      |
	    | Operation	    |  w/o FPU	|  w/ FPU   | LSI-11/73 | SBC  | KXT11|
	    |		    |  u     m	|  u	 m  |  u     m	|11/21+|  -CA |
	    +---------------+-----------+-----------+-----------+------+------+
	    |Process	    |		|	    |		|      |      |
	    |	  creation  | 3.1  5.48 | 3.56 5.93 | 1.84 2.64 | 3.96 | 2.71 |
	    |	  deletion  | 2.4  4.19 | 2.55 4.35 | 1.14 1.92 | 2.96 | 2.06 |
	    +---------------+-----------+-----------+-----------+------+------+
	    |Schedule +	    |		|	    |		|      |      |
	    | Context Switch| 0.56 0.97 | 0.82 1.27 | 0.38 0.57 | 0.69 | 0.49 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | Ring_buffer   |		|	    |		|      |      |
	    |  1 character  |		|	    |		|      |      |
	    |		get | 0.55 0.96 | 0.55 0.99 | 0.27 0.42 | 0.67 | 0.47 |
	    |		put | 0.50 0.93 | 0.51 0.95 | 0.25 0.39 | 0.63 | 0.43 |
	    |  2 characters |		|	    |		|      |      |
	    |		get | 0.61 1.05 | 0.61 1.05 | 0.29 0.43 | 0.72 | 0.51 |
	    |		put | 0.58 1.01 | 0.58 1.02 | 0.28 0.42 | 0.70 | 0.49 |
	    |  4 characters |		|	    |		|      |      |
	    |		get | 0.73 1.20 | 0.73 1.18 | 0.36 0.50 | 0.88 | 0.62 |
	    |		put | 0.71 1.17 | 0.71 1.15 | 0.35 0.49 | 0.86 | 0.60 |
	    | Signal Semaphr|		|	    |		|      |      |
	    |  by descriptor| 0.35 0.64 | 0.35 0.65 | 0.16 0.25 | 0.44 | 0.30 |
	    |  by name	    | 0.61 0.93 | 0.61 0.94 | 0.27 0.37 | 0.75 | 0.52 |
	    |  fast named   | 0.36 0.65 | 0.36 0.66 | 0.17 0.29 | 0.44 | 0.30 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | Get_status    | 0.42 0.84 | 0.42 0.85 | 0.20 0.33 | 0.50 | 0.35 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | Send + Receive|		|	    |		|      |      |
	    |	(by value)  |		|	    |		|      |      |
	    |	  -  1 Byte | 1.17 2.18 | 1.18 2.20 | 0.59 0.89 | 1.45 | 1.01 |
	    |	  - 34 Bytes| 1.46 2.50 | 1.46 2.51 | 0.73 1.11 | 1.79 | 1.24 |
	    | Send + Receive|		|	    |		|      |      |
	    | (by reference)|		|	    |		|      |      |
	    |	 -  10 Bytes| 1.26 2.28 | 1.26 2.31 | 0.67 0.96 | 1.54 | 1.08 |
	    |	 - 100 Bytes| 1.59 2.64 | 1.59 2.67 | 0.84 1.14 | 1.94 | 1.35 |
	    |	 - 500 Bytes| 3.09 4.32 | 3.09 4.35 | 1.74 2.11 | 3.78 | 2.63 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | TAN	    | 6.84 7.74 | 1.64 1.68 | 0.35 0.36 | 9.00 | 6.24 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | SIN	    | 5.13 5.82 | 1.75 1.78 | 0.33 0.34 | 6.80 | 4.69 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | COS	    | 6.19 7.00 | 1.94 1.98 | 0.39 0.39 | 8.15 | 5.64 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | EXP	    | 5.04 5.69 | 1.45 1.48 | 0.32 0.33 | 6.55 | 4.59 |
	    +---------------+-----------+-----------+-----------+------+------+
	    | LN	    | 5.34 6.01 | 1.27 1.31 | 0.28 0.29 | 6.95 | 4.86 |
	    +---------------+-----------+-----------+-----------+------+------+

		 Table 1: MicroPower/Pascal V1.5 Runtime System (millisec)

									Page 5


				    Notes for Table 1
				    -----------------
			  o  u = without MMU  and m = with MMU
			  o  FPU = with floating point unit  (KEF11)
			  o  Send/Receive without context-switch
			  o  SBC-11/21+ using on-board memory only


	     +------------------------+-----------+-----------+-------+-------+
	     | Operation	      | LSI-11/23 | LSI-11/73 |	 SBC  | KXT11 |
	     |			      |	 u	m |  u	    m | 11/21+|	 -CA  |
	     +------------------------+-----------+-----------+-------+-------+
	     |	ISR:		      |		  |	      |	      |	      |
	     |			      |		  |	      |	      |	      |
	     | Interrupt dispatch-    |		  |	      |	      |	      |
	     |	time (usec)	      | 62     91 | 42	   54 |	  81  |	  61  |
	     |			      |		  |	      |	      |	      |
	     | ISR execution	      |		  |	      |	      |	      |
	     |	 time (usec)	      | 20     23 |   13.4    |	  21  |	  16  |
	     |			      |		  |	      |	      |	      |
	     | Maximal interrupt-     |		  |	      |	      |	      |
	     |	 frequency (kHz)      | 7.0   5.1 | 12.9 10.9 |	 4.8  |	 7.5  |
	     +------------------------+-----------+-----------+-------+-------+
	     |	PRIO7 ISR:	      |		  |	      |	      |	      |
	     |			      |		  |	      |	      |	      |
	     | Interrupt dispatch-    |		  |	      |	      |	      |
	     |	time (usec)	      | 28.5   60 | 22	   38 |	  32  |	  28  |
	     |			      |		  |	      |	      |	      |
	     | ISR execution	      |		  |	      |	      |	      |
	     |	 time (usec)	      | 20     24 |   13.4    |	  21  |	  16  |
	     |			      |		  |	      |	      |	      |
	     | Maximal interrupt-     |		  |	      |	      |	      |
	     |	 frequency (kHz)      | 17.8  9.3 | 26	   16 |	 12.8 |	 16.5 |
	     +------------------------+-----------+-----------+-------+-------+
	     | CONNECT_SEMAPHORE: (one process waiting on that semaphore)     |
	     |								      |
	     | Interrupt dispatch +   |		  |	      |	      |	      |
	     |	 context-switch time  |		  |	      |	      |	      |
	     |	  (msec)	      | 0.88 1.36 | 0.49 0.63 |	 1.15 |	 0.82 |
	     |			      |		  |	      |	      |	      |
	     | Maximal interrupt-     |		  |	      |	      |	      |
	     |	   frequency (kHz)    | 0.67 0.39 | 1.20 0.83 |	 0.41 |	 0.75 |
	     +------------------------+-----------+-----------+-------+-------+

			      Table 2: Interrupt Performance

				     Note for Table 2
				     ----------------
		 Additionally, the system had to service the  clock  interrupt
		 at a rate of 50 Hz without the clock driver implemented, i.e.
		 the interrupt dispatcher discarded the interrupt.  The	 clock
		 interrupt was enabled because realistically most systems have
		 the clock enabled.