Poor man’s CPU stress test

Just a few days ago I had to stress test the CPU on a machine with nothing installed but bare Linux and no internet access.

I googled a bit, found a couple bc expressions and modified one that calculates 5000 characters of pi like this, so that it runs indefinitely:

$ while true; do time echo "scale 5000; a(1)*4" | bc -l; done

This is of course non-parallel, so run as many of these as you have cores to get almost 100% CPU load:

It’s also a great benchmark for CPU performance, just record the time and compare it to friends’ results :)

2013   Tech
Popular