Linux cpu speed test

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:

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:

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

  • “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.

Читайте также:  Whatsapp desktop linux deb

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

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 to make it stop.

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:

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 to make it stop.

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:

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:

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 to make it stop.

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:

To run single threaded benchmark, use the command below:

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

Читайте также:  Создать сервер майнкрафт linux

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

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

Источник

How to test CPU performance in Linux

In the past, CPU cycle speed was the primary indicator of a CPU‘s performance. However, modern CPUs from various manufacturers now feature different architectures and optimizations, making benchmarks necessary to assess their actual speed.

CPU benchmarking tools execute tasks on the CPUs and measure the time taken for completion. Some tasks are purely synthetic, while others attempt to mimic real-world usage. Regardless, it is impossible for these tasks to fully represent the diverse ways in which individuals utilize CPUs.

Although there are numerous third-party and commercial applications for conducting CPU benchmarks, sysbench is a widely-used, standard tool in Linux systems. It is available in the default package repositories of most Linux distributions.

Steps to benchmark CPU speed in Linux:

$ sudo apt update && sudo apt install --assume-yes sysbench #Ubuntu and variants > sudo zypper refresh && sudo zypper install --skip-interactive sysbench $ sudo dnf install sysbench
$ lscpu | grep "^CPU.s\|^Thread.s" CPU(s): 8 Thread(s) per core: 2
$ sysbench cpu run sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 1 Initializing random number generator from current time Prime numbers limit: 10000 Initializing worker threads. Threads started! CPU speed: events per second: 8651.52 General statistics: total time: 10.0002s total number of events: 86521 Latency (ms): min: 0.11 avg: 0.12 max: 1.21 95th percentile: 0.12 sum: 9987.69 Threads fairness: events (avg/stddev): 86521.0000/0.00 execution time (avg/stddev): 9.9877/0.00
$ sysbench cpu --threads=16 run sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 16 Initializing random number generator from current time Prime numbers limit: 10000 Initializing worker threads. Threads started! CPU speed: events per second: 16608.45 General statistics: total time: 10.0006s total number of events: 166101 Latency (ms): min: 0.11 avg: 0.96 max: 68.15 95th percentile: 0.13 sum: 159504.98 Threads fairness: events (avg/stddev): 10381.3125/69.32 execution time (avg/stddev): 9.9691/0.02
$ sysbench cpu --threads=16 --time=60 run sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3) Running the test with following options: Number of threads: 16 Initializing random number generator from current time Prime numbers limit: 10000 Initializing worker threads. Threads started! CPU speed: events per second: 16649.33 General statistics: total time: 60.0007s total number of events: 998978 Latency (ms): min: 0.11 avg: 0.96 max: 101.62 95th percentile: 0.13 sum: 958670.12 Threads fairness: events (avg/stddev): 62436.1250/236.58 execution time (avg/stddev): 59.9169/0.03
$ sysbench --help Usage: sysbench [options]. [testname] [command] Commands implemented by most tests: prepare run cleanup help General options: --threads=N number of threads to use [1] --events=N limit for total number of events [0] --time=N limit for total execution time in seconds [10] --forced-shutdown=STRING number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off] --thread-stack-size=SIZE size of stack per thread [64K] --rate=N average transactions rate. 0 for unlimited rate [0] --report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0] --report-checkpoints=[LIST. ] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. [] --debug[=on|off] print more debugging info [off] --validate[=on|off] perform validation checks where possible [off] --help[=on|off] print help and exit [off] --version[=on|off] print version and exit [off] --config-file=FILENAME File containing command line options --tx-rate=N deprecated alias for --rate [0] --max-requests=N deprecated alias for --events [0] --max-time=N deprecated alias for --time [0] --num-threads=N deprecated alias for --threads [1] Pseudo-Random Numbers Generator options: --rand-type=STRING random numbers distribution [special] --rand-spec-iter=N number of iterations used for numbers generation [12] --rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1] --rand-spec-res=N percentage of 'special' values to use (for special distribution) [75] --rand-seed=N seed for random number generator. When 0, the current time is used as a RNG seed. [0] --rand-pareto-h=N parameter h for pareto distribution [0.2] Log options: --verbosity=N verbosity level [3] --percentile=N percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95] --histogram[=on|off] print latency histogram in report [off] General database options: --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql] --db-ps-mode=STRING prepared statements usage mode [auto] --db-debug[=on|off] print database-specific debug information [off] Compiled-in database drivers: mysql - MySQL driver pgsql - PostgreSQL driver mysql options: --mysql-host=[LIST. ] MySQL server host [localhost] --mysql-port=[LIST. ] MySQL server port [3306] --mysql-socket=[LIST. ] MySQL socket --mysql-user=STRING MySQL user [sbtest] --mysql-password=STRING MySQL password [] --mysql-db=STRING MySQL database name [sbtest] --mysql-ssl[=on|off] use SSL connections, if available in the client library [off] --mysql-ssl-cipher=STRING use specific cipher for SSL connections [] --mysql-compression[=on|off] use compression, if available in the client library [off] --mysql-debug[=on|off] trace all client library calls [off] --mysql-ignore-errors=[LIST. ] list of errors to ignore, or "all" [1213,1020,1205] --mysql-dry-run[=on|off] Dry run, pretend that all MySQL client API calls are successful without executing them [off] pgsql options: --pgsql-host=STRING PostgreSQL server host [localhost] --pgsql-port=N PostgreSQL server port [5432] --pgsql-user=STRING PostgreSQL user [sbtest] --pgsql-password=STRING PostgreSQL password [] --pgsql-db=STRING PostgreSQL database name [sbtest] Compiled-in tests: fileio - File I/O test cpu - CPU performance test memory - Memory functions speed test threads - Threads subsystem performance test mutex - Mutex performance test See 'sysbench help' for a list of options for each test.

Источник

Оцените статью
Adblock
detector