How to benchmark CPU performance on Ubuntu?
Benchmarking CPU performance on Ubuntu involves isolating your system
environment and running standardized utility tests like
sysbench or Geekbench to measure processing
speeds under load. This article walks you through preparing your system,
executing tests for both single-core and multi-core evaluations, and
interpreting the metrics to gauge your hardware’s capabilities.
System Preparation
To get accurate and reproducible benchmark results, you must minimize variables caused by background activities or software configurations.
- Close background applications: Terminate active browser tabs, development servers, and non-essential GUI software.
- Configure power settings: Ensure Ubuntu is set to
prioritize performance over power saving. You can install
cpufrequtilsto set the governor manually:
sudo apt install cpufrequtils -y
sudo cpufreq-set -g performance- Monitor system temperatures: Thermal throttling
skewing your benchmarks is a common issue. Install
lm-sensorsto track heat metrics in real time during execution:
sudo apt install lm-sensors -y
watch -n 1 sensorsOption 1: Quick Command-Line Benchmarking with Sysbench
sysbench is a lightweight, widely utilized command-line
tool that evaluates CPU capabilities by calculating prime numbers.
Installation
Update your package repository and install the utility directly through standard APT:
sudo apt update
sudo apt install sysbench -yRunning a Single-Core Test
To evaluate single-threaded throughput—crucial for apps that do not scale natively across multiple cores—run the execution flag while forcing a single worker thread:
sysbench cpu --cpu-max-prime=20000 --threads=1 runRunning a Multi-Core Test
To test aggregate computational throughput across your entire system
architecture, substitute the thread count flag with your total logical
CPU cores using the nproc variable:
sysbench cpu --cpu-max-prime=20000 --threads=$(nproc) runAnalyzing the Output
Focus primarily on the events per second metric under the CPU speed summary. A higher value denotes superior computational speed. Multi-core events per second should scale almost linearly with your system’s core count compared to the single-thread metric.
Option 2: Full-Scale Industry Testing with Geekbench
For deep-dive architectural comparisons against public databases,
Geekbench offers a cross-platform testing suite suited for
modern multi-threaded workloads.
Download and Extraction
Since it is not hosted in standard Ubuntu repositories, pull the official Linux binaries directly:
GB_VERSION="6.3.0"
wget "https://cdn.geekbench.com/Geekbench-${GB_VERSION}-Linux.tar.gz"
tar -xzf "Geekbench-${GB_VERSION}-Linux.tar.gz"
cd "Geekbench-${GB_VERSION}-Linux"Executing the Test Suite
Launch the binary. If you are operating on a headless server or wish
to suppress automatic browser prompts, use the --no-upload
parameter alongside local save arguments:
./geekbench6 --no-upload --save results.txtAlternatively, running it without options uploads your raw system performance score directly to the Geekbench online browser via a temporary URL, enabling swift performance comparisons against identical CPU models worldwide.