[net.micro.pc] Query: problem with onboard clock use

abh6509@ritcv.UUCP (A. Hudson) (10/16/85)

    In preparation for real-time applications using a standard IBM PC 
we did some benchmarking of loops. Using an ABSOLUTE call to a supplied 
machine code routine that reads current system time, precise to hundreths 
of a second, the time was recorded before and after an empty FOR NEXT loop.

1600 'EMPTY LOOP TIME DELAY
1610 ROUT=0 : CALL ABSOLUTE(H%,M%,S%,T%,ROUT) 
1620 FOR I = 1 TO 1000 : NEXT I : ROUT = 0 : CALL ABSOLUTE(HL%,ML%,SL%,TL%,ROUT)
1630 T1 = 3600*(HL%-H%)+60*(ML%-M%)+(SL%-S%)+0.1*(TL%-T%) 
1640 LPRINT USING "T=##.### SEC";T1
1650 RETURN

FOR T = 10000		FOR T = 1000

T= 6.480		T= 0.660
T= 6.420		T= 0.610
T= 6.430		T= 0.600
T= 6.480		T= 0.660
T= 6.480		T= 0.610
avg(T) = 6.47           avg(T) = 0.627

    The results were very disheartening, not only did each loop with
the same iteration count vary from test to test, but different iteration
counts had different averages! This is using the onboard clock, not
the quadboard or calendar/clock board.

    I suspect interrupts of some sort happening spuradically during
the loop. Any diagnosis for this malady, especially with prognosis,
would be appreciated. 

Andrew Hudson
ritcv!abh6509