Showing posts with label cpu. Show all posts
Showing posts with label cpu. Show all posts

Saturday, August 15, 2009

Detect and monitor CPU cores




If you have several CPUs on your system or multicore CPU, you can detect number of cores with this simple command:

$ cat /proc/cpuinfo | grep processor | wc -l
2

To determine the usage of each core you can use standard top command. By default it shows only summary usage, however you can toggle between summary and per core usage with the '1' key after starting the top.

Thursday, August 13, 2009

Bc as cpu benchmark

My previous post (http://tuxshell.blogspot.com/2009/08/shell-as-calculator.html) was about making math calculation in shell. I showed how to calculate PI number up to n digits. I thought, together with time command it can be used as CPU benchmark. This kind of calculation is cpu intensive and takes some time. Let's calculate up to 5000 digits after period. We measure the time of doing it with time command and look for real value:

$ time echo "scale=5000; a(1)*4" | bc -l

My computer did it within 37.194s. How about yours?