[ECOS] Functions to consume CPU time in x86

Hugo Tyson hmt@redhat.com
Thu Mar 29 11:50:00 GMT 2001


Cristiano Ligieri Pereira <cpereira@ics.uci.edu> writes:

> I need to implement some functions to keep the CPU busy for some amounts
> of time. I know that one way to do that is to build loops that do nothing
> other than keep the CPU busy. I would like to have functions to consume
> hundreds or thousands of nanoseconds of CPU time in x86 platform. Has
> anyone done this before? If so, would you be up to provide me such
> functions?

There is something in the net tests, in net/tcpip/VERSION/tests/tcp_echo.c
that keeps the CPU busy a certain *percentage* of its capability.

Not what you asked for, but you might find it of interest - especially the
way it calibrates itself for differing platforms, which might be useful to
you in this?

Doesn't hal_delay_us(int) AKA CYGACC_CALL_IF_DELAY_US(_u_) via virtual
vectors do almost what you want?  It's defined to be a busy wait.  It's in
uS not nS, but it should be another place to start.

	- Huge



More information about the Ecos-discuss mailing list