Thursday, June 18, 2009

Generating CPU activity

sometimes you might want to generate some cpu activity, to maybe test a new CPU or check performance scripts etc.

On the command line:

while :
do
:
done

or:

while true
do
cat /dev/urandon >/dev/null
done

and then use mpsched to assign a cpu to the process:

mpsched -c /usr/bin/cat /dev/urandom > /dev/null &

or in c:

#include
#include
main()
{
int i=0;
float X[1024],Y[1024];

while (1)
{

for(i=0;i<1024;i++)
{
X[i]=1;
Y[i]=X[i] * M_PI; # M_PI is defined in /usr/include/math.h
}
}
}


1 comment:

Anonymous said...

Hiya very cool web site!! Man .. Beautiful .. Amazing .
. I'll bookmark your site and take the feeds additionally? I am glad to seek out numerous useful info here in the put up, we want work out more techniques on this regard, thank you for sharing. . . . . .

My blog post :: best flight simulator for pc