22

I have used many times ab for measuring web performance, hdparm for measuring hard disk performance and netperf for measuring network performance.

But I didn't find any tools to measure cpu performance.

Do you know a tool allowing to measure cpu performance? I am more specifically looking to measure Gflops.

peterh
  • 9,488
  • 16
  • 59
  • 88
Coren
  • 4,970
  • 1
  • 24
  • 43

3 Answers3

11

You should take a look at the Wikipedia page on benchmarking, it gives quite a few benchmark tools including the CPU ones that will work on Linux. LinPack is free but a pain to compile. But you can certainly look at NBench and some others in the list.

A.L
  • 1,492
  • 3
  • 15
  • 29
Karlson
  • 5,845
  • 32
  • 51
3
$ date; i=0; while (( i < 1000000 )); do (( i ++ )); done; date
Tue Jul 15 11:26:37 EDT 2014
Tue Jul 15 11:26:43 EDT 2014
$
JohnMudd
  • 250
  • 2
  • 8
  • 2
    Would that be 43 - 37 = 6 GigaFlops? I fail to see how an integer increment in a shell, relates to floating point performance. – Anthon Jul 15 '14 at 16:58
  • The general goal was "measure cpu performance". Later mentions Gflops but I think that's actually a misguided tangent. If Gflops was the true goal then asking about CPU performance was a mistake. – JohnMudd Jul 16 '14 at 15:29
  • Quicker way to get to the number you're really after, i.e. *seconds that have passed*: `DATE=$(date +%s); i=0; while (( i < 1000000 )); do (( i ++ )); done; echo $(( $(date +%s)-DATE ))` – xenithorb Mar 07 '15 at 21:23
  • 1
    Good point, I should have updated this earlier. Here's my current approach: time ( i=0; while (( i < 1000000 )); do (( i ++ )); done ) – JohnMudd Mar 09 '15 at 12:58
  • 1
    This is not 6 gigaflops, this is ~0.17 megabashincrements. And, my macbook owns all: `( i=0 ; while (( i < 1000000 )); do; (( i ++ )); done; ) 1.33s user 0.00s system 99% cpu 1.337 total` – Steven Lu Jan 29 '16 at 16:39
  • This will tell you far more about the version of bash or type of shell being used than the performance of your CPU. – slang Dec 06 '16 at 07:36
3

stress-ng is a simple tool that can stress and benchmark the cpus.

For example, tested 1 cpu

stress-ng -c 1 --cpu-ops 5000

stress-ng: info: [20288] defaulting to a 86400 second run per stressor

stress-ng: info: [20288] dispatching hogs: 1 cpu

stress-ng: info: [20288] successful run completed in 13.93s

michaelbn
  • 768
  • 6
  • 7
  • I think advising a stress testing program to benchmark is misleading: there is a big difference between benchmarking and stressing a CPU. – Paradox Mar 10 '19 at 23:39