want to control the cpu load to test the power consume at a specified load.

Exemple:
-Fix the load at 65% and check the power consume of the computer using a Voltage and Current meter


I was thinking in something like this:
sleep(x);
/*X time (X float and inside [0;1]) */
while(1);
/* during 1-X time */

This doesn't work because the time unit is to large (sleep only accept seconds), i want something like miliseconds ou even microseconds.

Any idea?

Thanks