bsd4.2 on 11/785

Roy Smith roy at phri.UUCP
Fri Oct 18 00:55:03 AEST 1985


> there really ought to be a way to build a decent
> delay routine without making processor speed assumptions
> Chuq Von Rospach (Currently: nsc!chuqui at decwrl.ARPA)

	How about during the (very) early boot stages, you set a hardware
real-time timer for 1 second then start counting up from zero?  When you
get the interrupt you have the speed of the processor in trivial_for_loops
per second.  Divide this by 1000, save the result, and you can then
calculate processor-independent ms-range delay loops whenever you have to.

	This doesn't help if you really want a delay *macro*, but I'm
assuming that if you want a 5ms delay, you don't care about the function
call overhead.
-- 
Roy Smith <allegra!phri!roy>
System Administrator, Public Health Research Institute
455 First Avenue, New York, NY 10016



More information about the Comp.unix.wizards mailing list