I am testing a scheduller that has a timeout based on a used CPU time.
To test it, I need some simple alternative that
will be equal to sleep <timeout is seconds as a float>
that
will loop, i.e. utilize a CPU time and return once the timeout is elapsed.
How to write it simply in a shell?
One possible solution:
timeout 5 sha1sum /dev/zero
Advantages:
timeout
and sha1sum
presented in any standard linuxsha1sum
can be easily replaced with some multi-threaded command to utilize more than one CPU