I have to simulate load on a computer. Ideally what I would like to do is be able to manipulate the load on the computer, ie load it to like 20% per instance running. Or be able to vary it within the code.
So far my approach has been to create an infinite loop that will load the cpu to 100% and then introduce a variable pause, but I have found this difficule to achieve.
The code is roughly
//infinite loop
usleep(100);
Also I would like to be able to do the same sort of loading with the disk, which I have something that will write a series of numbers then read them again, then proceed to rewrite them.
Neither of these have worked for me, any pointers in the right dircection.
Thanks,
Nick