I am looking for a utility that will benchmark CPU performance under single and multi threaded instances. At present I have an old rig with a dual core CPU (E7500) at 3.6 Ghz and I am looking at replacing it with a quad core CPU (Q9400) at 3.2 Ghz. I want to see if I will notice a performance improvement with the extra 2 cores (albeit with a drop in core speed). I will clock the CPU's with the same FSB (400Mhz) and the cache size is the same per CPU (1.5MB) and for what its worth I have 4GB ram (with potential to upgrade to 6GB)

My son mainly uses the PC for playing TF2 (which I am trying to still get working under Linux) and I also use it for some video encoding (MP4 to DVD)

I am thinking that I could be better off with the quad core but any feedback would be appreciated.

  • 2
    There is Geekbench which can compare CPUs (there are already existing test results for the e7500 and the q9400, though many are in drastically different setups, which will have different bus speeds etc. – Wilf Jun 10 '15 at 10:18

Actually there is a a tool named as sysbench.

You can install it with sudo apt-get install sysbench

To CPU benchmarking you can do like

sysbench --test=cpu --cpu-max-prime=20000 run

where 20000 is like max event count.

  • 5
    --cpu-max-prime=20000 is optional, the default being 10000. I suggest to keep the default and fiddle with --max-requests instead (which is the number of operations performed) – MestreLion Mar 22 '16 at 17:29
  • 9
    Also note that by default this is a single-threaded test. For testing N cores you can use --num-threads=N, and compare results using the per-request statistics output. – MestreLion Mar 22 '16 at 17:31

Alternatively, one can use stress-ng. It has a CPU stress test as one of the many stress tests built into the tool. The cpu stress test contains many different CPU stress methods covering integer, floating point, bit operations, mixed compute, prime computation, and a wide range of computations.

Install using:

sudo apt-get install stress-ng

To see the cpu related stress methods use:

stress-ng --cpu-method which

To benchmark, for example, matrix product for 60 seconds on 4 CPU threads, use:

stress-ng --cpu 4 --cpu-method matrixprod  --metrics-brief --perf -t 60
stress-ng: info:  [15876] dispatching hogs: 4 cpu
stress-ng: info:  [15876] successful run completed in 60.00s (1 min, 0.00 secs)
stress-ng: info:  [15876] stressor      bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
stress-ng: info:  [15876]                          (secs)    (secs)    (secs)   (real time) (usr+sys time)
stress-ng: info:  [15876] cpu              71657     60.00    239.60      0.00      1194.25       299.07
stress-ng: info:  [15876] cpu:
stress-ng: info:  [15876]            885,244,279,148 CPU Cycles                    14.75 B/sec
stress-ng: info:  [15876]          1,289,303,858,968 Instructions                  21.49 B/sec (1.456 instr. per cycle)
stress-ng: info:  [15876]            201,499,961,692 Cache References               3.36 B/sec
stress-ng: info:  [15876]                    790,424 Cache Misses                  13.17 K/sec ( 0.00%)
stress-ng: info:  [15876]            157,689,508,544 Branch Instructions            2.63 B/sec
stress-ng: info:  [15876]              1,232,539,732 Branch Misses                 20.54 M/sec ( 0.78%)
stress-ng: info:  [15876]              5,755,605,036 Bus Cycles                    95.92 M/sec
stress-ng: info:  [15876]            817,296,440,876 Total Cycles                  13.62 B/sec
stress-ng: info:  [15876]                      8,532 Page Faults Minor            142.19 sec  
stress-ng: info:  [15876]                          0 Page Faults Major              0.00 sec  
stress-ng: info:  [15876]                        220 Context Switches               3.67 sec  
stress-ng: info:  [15876]                          0 CPU Migrations                 0.00 sec  
stress-ng: info:  [15876]                          0 Alignment Faults               0.00 sec  
  • 3
    " Unable to locate package stress-ng!" – Ehsan M. Kermani Feb 5 '16 at 0:09
  • 1
    If you have an older release, stress-ng won't be available from the archive. However, they are packaged in ppa:colin-king/white – Colin Ian King Mar 3 '16 at 16:56
  • @EhsanM.Kermani : it's available in the repositories only from Ubuntu 15.14 onwards (and to 14.04 using the backports repository). See packages.ubuntu.com/… – MestreLion Mar 22 '16 at 17:36
  • 1
    From the stress-ng manpage: "stress-ng can also measure test throughput rates; this can be useful to observe performance changes across different operating system releases or types of hardware. However, it has never been intended to be used as a precise benchmark test suite, so do NOT use it in this manner." – Michael Franzl Feb 23 '18 at 10:17
  • 2
    As the author of stress-ng, I'd better elaborate on this. stress-ng is good enough to get some comparative benchmarks results out of it, but it is not been thoroughly calibrated to say how much deviation there is on the each specific stressor. I therefore suggest running a stress-ng stressor several times and seeing how much variation there is on a specific stress test, and if it does not vary much, then it can be considered reliable enough for a benchmark for that specific use case. It all depends on now noisy/busy a system is, how well I/O performs, if it swaps, etc. – Colin Ian King Feb 23 '18 at 11:49


sudo apt-get install phoronix-test-suite
phoronix-test-suite list-available-suites
# Chose one, and run it.
phoronix-test-suite run pts/cpu    

Benchmarks several real world CPU-heavy use cases like compression, encryption and databases.

Beware that pts/cpu and other benchmarks takes up a few gigabytes of disk space. This might imply that they have more realistic workloads.

Tested on Ubuntu 16.10.

  • 2
    @downvoters please explain :-) – Ciro Santilli 新疆改造中心996ICU六四事件 Oct 30 '17 at 17:41
  • 2
    Thanks. I drowned in test options, using build-suite on my first round with phoronix. – andersoyvind Jan 16 '18 at 8:53
  • 1
    it's not in debian 9, but you can still download the .deb from phoronix-test-suite.com/?k=downloads and run sudo apt install ./phoronix-test-suite(...).deb – hanshenrik Jul 18 '18 at 11:02
  • 1
    One thing that should be mentioned when describing the PTS is the size of its benchmarks. Running the mentioned pts/cpu benchmark downloads about 3GB of data and uses about 7GB of disk space (in the user's home directory). – stefanct Jul 23 '18 at 16:31
  • Agreed, if you are looking for a simple benchmark then you don't want phoronix-test-suite, it's massive, and keeps asking to download more and more dependencies to run tests. (I'm sure it's very thorough when you actually want this though) – Jamie Pate Sep 8 '18 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.