Linux的CPU基准测试实用程序

我正在寻找一个实用程序,它将在单线程和multithreading实例下对CPU性能进行基准测试。 目前我有一台配备3.6 Ghz双核CPU(E7500)的旧机器,我正在考虑用3.2 Ghz的四核CPU(Q9400)替换它。 我想看看我是否会注意到额外的2个核心的性能提升(尽管核心速度下降)。 我将使用相同的FSB(400Mhz)对CPU进行计时,并且每个CPU(1.5MB)的高速缓存大小相同,并且我有4GB内存(可能升级到6GB)

我的儿子主要使用PC来播放TF2(我试图在Linux下工作)我还用它来进行一些video编码(MP4到DVD)

我想我可能会更好地使用四核,但任何反馈都会受到赞赏。

实际上有一个名为sysbench工具。

您可以使用sudo apt-get install sysbench安装它

对于CPU基准测试,您可以这样做

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

其中20000就像最大事件数。

或者,可以使用stress-ng 。 它具有CPU压力测试作为工具内置的众多压力测试之一。 cpu压力测试包含许多不同的CPU压力方法,包括整数,浮点,位操作,混合计算,素数计算和各种计算。

安装使用:

 sudo apt-get install stress-ng 

要查看与cpu相关的压力方法,请使用:

 stress-ng --cpu-method which 

例如,要在4个CPU线程上对矩阵产品进行基准测试60秒,请使用:

 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 

phoronix-测试套件

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

对几个真实的CPU大量使用情况进行基准测试,如压缩,加密和数据库。

请注意, pts/cpu和其他基准测试占用了几千兆字节的磁盘空间。 这可能意味着他们有更实际的工作负载。

在Ubuntu 16.10上测试过。