[Scottish] CPU Testing

Martin McCarthy scottish at mailman.lug.org.uk
Thu Feb 27 16:39:02 2003

> I'm currently setting up MRTG to graph my CPU usage, but I need something to
> help prove what I've done works, anyone got a short piece of C code that'll
> push the gas peddle on my Linux box and keep the cpu cycles high for a few
> mins?

Since we all get to post our favourites :-), you can do this at a shell
prompt (bash, ksh, zsh, Bourne shell - dunno about csh):

  while(true) do : ; done

and that should give you 100% CPU usage but no danger of actually
hanging your machine with fork bombs.

Martin McCarthy                 /</         http://www.non-prophet.org
marty@ancient-scotland.co.uk    \>\  http://www.ancient-scotland.co.uk
                                /</    http://www.ehabitat.demon.co.uk