Performance Utilities

6 Useful Linux Apps to Stress Test and Benchmark CPU Performance

Benchmark and stress test methods are often used to gauge the performance of desktop PCs and servers. These tests are also useful in finding hardware problems and system anomalies that are observed only when a system is under heavy load.

This article will list various utilities to perform CPU benchmarks and stress tests on your system. While many of these apps provide options to test other hardware components as well, this article will focus on CPU tests only.

HardInfo (Benchmark Only)

HardInfo is a graphical utility for Linux that displays information about various hardware components in your PC like processor, RAM modules, sensors, hard drives and so on. It also supports exporting a detailed report about your system in txt or html format so that you can share it with your friends, compare it with other systems or use it for debugging purposes.

Besides showing general information about your system, HardInfo provides a few benchmark tools to measure the performance of your hardware. As far as CPU benchmarking is concerned, it includes five methods: CPU Blowfish, CPU CryptoHash, CPU Fibonacci, CPU N-Queens and CPU Zlib.

To install HardInfo in Ubuntu, run the command below:

$ sudo apt install hardinfo

To run a CPU benchmark, click on any benchmark method under “Benchmarks” section, as shown in the screenshot below.

Once the benchmark has finished, HardInfo will tell you if a lower or higher score is better. It also displays scores for CPUs made by other vendors for easy comparison.

Sysbench (Benchmark Only)

Sysbench, as the name suggests, is a command line app to run benchmarks on your system. Written in Lua, Sysbench is mainly intended for doing database benchmarking. However it includes options to test CPU, memory and file throughput as well.

To install Sysbench in Ubuntu, run the command below:

$ sudo apt install sysbench

To start a benchmark using Sysbench, run the following command:

$ sysbench cpu --threads=2 run

Where:

  • “cpu” is the test type
  • “threads” is the number of threads created by sysbench to perform multi-threaded benchmarking

You can use other command line switches to customize the benchmark behavior. More details about these options can be found here.

Once the test has finished, you can use the “events per second” variable to gauge the performance of your CPU. Unfortunately unlike HardInfo, Sysbench does not provide benchmark results of other CPU models made by various hardware vendors out there. If you have multiple computers, you can run the test on both and then compare the numbers. Higher is the number of events per second, better is the CPU performance.

Stress (Stress Test Only)

Stress is a simple command line utility to conduct CPU, memory and disk input-output stress tests.

You can install stress in Ubuntu by running the following command:

$ sudo apt install stress

Note that Stress will not run any benchmark test on your system, instead it will consistently hammer the CPU and make it run at 100%. You are advised to close all the running apps before doing a test. Running Stress for a longer period can crash the system and you may need to do a hard reboot to recover the system.

You can start the stress test by running the command below where “cpu” refers to the number of threads used for performing the test. To stop the test anytime, close the terminal or press <CTRL + C> to make it stop.

$ stress --cpu 2

I used Stress extensively when I built a new PC for myself a year back. It helped me greatly in tweaking fan speeds in BIOS for improved cooling.

Stress-ng (Stress Test Only)

Stress-ng is an updated implementation of Stress tool mentioned above. It is much more advanced and includes hundreds of tests to put a load on your system.

You can install Stress-ng in Ubuntu by running the command below:

$ sudo apt install stress-ng

Note that the warning mentioned above applies to this tool as well. Running stress-ng for a long time can freeze your system making it recoverable through a hard reboot only.

You can start the stress-ng test by running the command below where “cpu” refers to the number of threads used for performing the test. To stop the test anytime, close the terminal or press <CTRL + C> to make it stop.

$ stress-ng --cpu 4

Running the command above will run around 70 CPU tests sequentially. However, you can run all of these tests in parallel by running the command below:

$ stress-ng --cpu 4 --all

It is possible to customize the command using many other command line switches, but explaining all of them here is beyond the scope of this article. You can explore these options from here.

S-tui (Stress Test Only)

S-tui is a CPU resource monitor that uses a terminal based graphical interface to display data and graphs.

It supports CPU stress testing using the Stress app listed above while giving you a nice bird’s eye view on the various CPU parameters like frequency, temperature and utilization.

S-tui can be installed in Ubuntu by running the command below:

$ sudo apt install s-tui stress

As it is just a terminal based frontend for Stress command line app, be vary of system lock up during high usage.

Run the following command to launch it. To stop the test anytime, close the terminal or press <CTRL + C> to make it stop.

$ s-tui

7-Zip (Benchmark Only)

7-Zip is a file compression tool that can do extreme levels of compression on files and store them in a reduced size 7z archive format. 7-Zip comes with a built-in option to run LZMA compression benchmarks for measuring CPU performance.

To install 7-Zip in Ubuntu, run command:

$ sudo apt install p7zip-full

To run single threaded benchmark, use the command below:

$ 7z b -mmt1

Multi-threaded benchmarking can be run by using the following command:

$ 7z b

The results are in million instructions per second (MIPS). You can compare these results with other CPU models from here.

Conclusion

These are some of the free and open source utilities that can run CPU benchmarks on your system. In the good old days, running Flash Player in Firefox was an excellent way to stress test your CPU. These days, however, all the apps mentioned above do a pretty good job.

About the author

Nitesh Kumar

Nitesh Kumar

I am a freelancer software developer and content writer who loves Linux, open source software and the free software community.