[ECOS] Functions to consume CPU time in x86

Lewin A.R.W. Edwards larwe@larwe.com
Wed Mar 28 12:31:00 GMT 2001

> > >And of course I want to be able to specify that I want to keep the CPU
> > >busy for specific X (mili/nano)seconds and not only keep it busy for some
> > >randon amount of time.
>Unless you've got access to a hardware counter (with a known
>clock rate), you're going to have to tune a delay loop for your

Oh, one silly thing I forgot - On Pentium and higher x86 CPUs, you have the 
TSC MSR which is incremented every CPU clock cycle. You can use this to 
measure elapsed time. For very small values this will obviously not be an 
accurate technique for yielding delays, though.

=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."

More information about the Ecos-discuss mailing list