Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!shelby!agate!ucbvax!f4.n494.z5.fidonet.ORG!011HFAA.WITSVMA From: 011HFAA.WITSVMA@f4.n494.z5.fidonet.ORG (011HFAA WITSVMA) Newsgroups: comp.sys.transputer Subject: (none) Message-ID: <37.27B64BD2@puddle.fidonet.org> Date: 11 Feb 91 14:19:25 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 118 To :- Transputer Users Processor Utilisation - An Alternative Approach "Inside The Transputer", D.A.P Mitchell et al. Blackwell Scientific Publications, Oxford, 1990 ISBN 0-632-01689-2 Mitchell et al. describe an alternative routine for estimating processor utilisation. The fundamental difference between this approach and Andy Rabagliati's SUPERVISOR procedure is in the implementation of the idle counter process. Mitchell's version of the process, IDLETIME, is listed below : ------------------------------------------------------------------------- .. SC IdleTime .. COMMENT This PROC extracted from : "Inside The Transputer", D. Mitchell, et al., Blackwell Scientific, Oxford, 1990, p. 77 PROC IdleTime (INT IdleCount, ExtraCount, Semaphore) INT L.IdleCount, L.ExtraCount : INT Back.Low.Ptr, FrontLowPtr : GUY LDC 0 -- initialise counters STL L.IdleCount LDC 0 STL L.ExtraCount :REPEAT LDL Semaphore -- read Semaphore CJ .END -- if zero terminate LDLP FrontLowPtr -- read low priority queue registers SAVEL LDL FrontLowPtr -- and compare front one with MinInt MINT DIFF CJ .INCIC -- if queue empty inc idle count LDL L.ExtraCount -- otherwise inc extra count ADC 1 STL L.ExtraCount J .PASS :INCIC LDL L.IdleCount -- inc idle count ADC 1 STL L.IdleCount :PASS -- add to end of low priority LDC 2 -- active queue LDLP 0 STARTP STOPP -- deschedule this process J .REPEAT :END LDL L.IdleCount -- return counts and finish STL IdleCount LDL L.ExtraCount STL ExtraCount : ------------------------------------------------------------------------- This procedure is used in very much the same way as the idle counter process is used by the SUPERVISOR. As shown below, IDLETIME is launched in parallel with the rest of the processes on the Transputer. On terminating (by setting SEMAPHORE to 0), the procedure returns the value of the idle counter (IDLECOUNT), and also an indication of the time taken up by the execution of the procedure itself (EXTRACOUNT). ------------------------------------------------------------------------- .. Initialize Semaphore := 1 IdleCount := 0 ExtraCount := 0 PAR SEQ ... Processes to be evaluated Semaphore := 0 -- terminate IdleTime () IdleTime (IdleCount, ExtraCount, Semaphore) ------------------------------------------------------------------------- As for the SUPERVISOR process, it is necessary to establish a calibration value relative to which the actual IDLECOUNT value can be measured. I have made use of the SUPERVISOR procedure (well, the one that appeared on this mailing list in October 1990) and the approach mentioned above. For a selection of examples designed to force a wide range of processor utilisation, the results, in both cases, were **identical**. So take your choice ... P.S. I would recommend Mitchell et al. to anyone who is interested in programming in assembly language. Regards Craig Faasen 011hfaa.witsvma@f4.n494.z5.fidonet.org "And if I live forever, I won't ever be the same For I have seen the sun rise in Zimbabwe ... " -- uucp: uunet!m2xenix!puddle!5!494!4!011HFAA.WITSVMA Internet: 011HFAA.WITSVMA@f4.n494.z5.fidonet.org