Linux性能测试UnixBench一键脚本

技术 秋水逸冰 106466浏览 13评论

unixbench

UnixBench是一个类unix系(Unix,BSD,Linux)统下的性能测试工具,一个开源工具,被广泛用与测试linux系统主机的性能。Unixbench的主要测试项目有:系统调用、读写、进程、图形化测试、2D、3D、管道、运算、C库等系统基准性能提供测试数据。

最新版本UnixBench5.1.3,包含system和graphic测试,如果你需要测试graphic,则需要修改Makefile,不要注释掉”GRAPHIC_TESTS = defined”,同时需要系统提供x11perf命令gl_glibs库。
下面的脚本使用了最新版UnixBench5.1.3来测试,注释了关于graphic的测试项(大多数VPS都是没有显卡或者是集显,所以图像性能无需测试),运行10-30分钟后(根据CPU内核数量,运算时间不等)得出分数,越高越好。

测试方法:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/unixbench.sh
chmod +x unixbench.sh
./unixbench.sh

测试项目:
Dhrystone 2 using register variables
此项用于测试 string handling,因为没有浮点操作,所以深受软件和硬件设计(hardware and software design)、编译和链接(compiler and linker options)、代码优化(code optimazaton)、对内存的cache(cache memory)、等待状态(wait states)、整数数据类型(integer data types)的影响。

Double-Precision Whetstone
这一项测试浮点数操作的速度和效率。这一测试包括几个模块,每个模块都包括一组用于科学计算的操作。覆盖面很广的一系列 c 函数:sin,cos,sqrt,exp,log 被用于整数和浮点数的数学运算、数组访问、条件分支(conditional branch)和程序调用。此测试同时测试了整数和浮点数算术运算。

Execl Throughput
此测试考察每秒钟可以执行的 execl 系统调用的次数。 execl 系统调用是 exec 函数族的一员。它和其他一些与之相似的命令一样是 execve() 函数的前端。

File copy
测试从一个文件向另外一个文件传输数据的速率。每次测试使用不同大小的缓冲区。这一针对文件 read、write、copy 操作的测试统计规定时间(默认是 10s)内的文件 read、write、copy 操作次数。

Pipe Throughput
管道(pipe)是进程间交流的最简单方式,这里的 Pipe throughtput 指的是一秒钟内一个进程可以向一个管道写 512 字节数据然后再读回的次数。需要注意的是,pipe throughtput 在实际编程中没有对应的真实存在。

Pipe-based Context Switching
这个测试两个进程(每秒钟)通过一个管道交换一个不断增长的整数的次数。这一点很向现实编程中的一些应用,这个测试程序首先创建一个子进程,再和这个子进程进行双向的管道传输。

Process Creation
测试每秒钟一个进程可以创建子进程然后收回子进程的次数(子进程一定立即退出)。process creation 的关注点是新进程进程控制块(process control block)的创建和内存分配,即一针见血地关注内存带宽。一般说来,这个测试被用于对操作系统进程创建这一系统调用的不同实现的比较。

System Call Overhead
测试进入和离开操作系统内核的代价,即一次系统调用的代价。它利用一个反复地调用 getpid 函数的小程序达到此目的。

Shell Scripts
测试一秒钟内一个进程可以并发地开始一个 shell 脚本的 n 个拷贝的次数,n 一般取值 1,2,4,8。(我在测试时取 1, 8)。这个脚本对一个数据文件进行一系列的变形操作(transformation)。

下面是我的一个512MB,2核,OpenVZ的VPS的跑分结果:

   BYTE UNIX Benchmarks (Version 5.1.3)

   System: vpn: GNU/Linux
   OS: GNU/Linux -- 2.6.32-042stab076.8 -- #1 SMP Tue May 14 20:38:14 MSK 2013
   Machine: i686 (i386)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4533.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 1: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4533.6 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   09:41:17 up 31 days,  9:21,  1 user,  load average: 0.23, 0.05, 0.02; runlevel 3

------------------------------------------------------------------------
Benchmark Run: Mon Jul 29 2013 09:41:17 - 10:09:29
2 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       17172222.3 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2600.2 MWIPS (10.0 s, 7 samples)
Execl Throughput                               4152.8 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        622759.5 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          172634.3 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1218236.9 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1416230.5 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 206509.4 lps   (10.0 s, 7 samples)
Process Creation                               8568.6 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   3145.9 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    528.3 lpm   (60.0 s, 2 samples)
System Call Overhead                        1528474.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   17172222.3   1471.5
Double-Precision Whetstone                       55.0       2600.2    472.8
Execl Throughput                                 43.0       4152.8    965.8
File Copy 1024 bufsize 2000 maxblocks          3960.0     622759.5   1572.6
File Copy 256 bufsize 500 maxblocks            1655.0     172634.3   1043.1
File Copy 4096 bufsize 8000 maxblocks          5800.0    1218236.9   2100.4
Pipe Throughput                               12440.0    1416230.5   1138.4
Pipe-based Context Switching                   4000.0     206509.4    516.3
Process Creation                                126.0       8568.6    680.0
Shell Scripts (1 concurrent)                     42.4       3145.9    742.0
Shell Scripts (8 concurrent)                      6.0        528.3    880.5
System Call Overhead                          15000.0    1528474.7   1019.0
                                                                   ========
System Benchmarks Index Score                                         960.4

------------------------------------------------------------------------
Benchmark Run: Mon Jul 29 2013 10:09:29 - 10:39:56
2 CPUs in system; running 2 parallel copies of tests

Dhrystone 2 using register variables       16851634.7 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     5182.9 MWIPS (10.0 s, 7 samples)
Execl Throughput                               4101.9 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        635244.9 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          174430.2 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1219982.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1387297.9 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 196296.1 lps   (10.0 s, 7 samples)
Process Creation                              10889.9 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   4073.7 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    550.5 lpm   (60.2 s, 2 samples)
System Call Overhead                        1538517.4 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   16851634.7   1444.0
Double-Precision Whetstone                       55.0       5182.9    942.3
Execl Throughput                                 43.0       4101.9    953.9
File Copy 1024 bufsize 2000 maxblocks          3960.0     635244.9   1604.2
File Copy 256 bufsize 500 maxblocks            1655.0     174430.2   1054.0
File Copy 4096 bufsize 8000 maxblocks          5800.0    1219982.0   2103.4
Pipe Throughput                               12440.0    1387297.9   1115.2
Pipe-based Context Switching                   4000.0     196296.1    490.7
Process Creation                                126.0      10889.9    864.3
Shell Scripts (1 concurrent)                     42.4       4073.7    960.8
Shell Scripts (8 concurrent)                      6.0        550.5    917.5
System Call Overhead                          15000.0    1538517.4   1025.7
                                                                   ========
System Benchmarks Index Score                                        1058.3

参考链接:
http://blog.sina.com.cn/s/blog_7695e9f40100yimf.html

转载请注明:秋水逸冰 » Linux性能测试UnixBench一键脚本

发表我的评论
取消评论

请输入正确答案后提交评论 *超出时限。 请再次填写验证码。

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (13)

  1. 国内VPS用不了了,dl.teddysun.com已被污染( 目前的解决方案是改hosts
    WooMai5年前(2018-11-28)回复
    • 感谢反馈。我已经将下载地址改了,目前应该可以在国内正常使用了。
      秋水逸冰5年前(2018-12-08)回复
  2. ------------------------------------------------------------------------ Benchmark Run: Fri Mar 31 2017 11:06:25 - 11:34:28 4 CPUs in system; running 1 parallel copy of tests Dhrystone 2 using register variables 39079281.0 lps (10.0 s, 7 samples) Double-Precision Whetstone 4294.7 MWIPS (9.9 s, 7 samples) Execl Throughput 4155.2 lps (29.8 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 772691.9 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 220721.2 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 1855948.5 KBps (30.0 s, 2 samples) Pipe Throughput 1759249.0 lps (10.1 s, 7 samples) Pipe-based Context Switching 176311.6 lps (10.0 s, 7 samples) Process Creation 10826.1 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 4587.4 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1574.0 lpm (60.0 s, 2 samples) System Call Overhead 2635416.8 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 39079281.0 3348.7 Double-Precision Whetstone 55.0 4294.7 780.8 Execl Throughput 43.0 4155.2 966.3 File Copy 1024 bufsize 2000 maxblocks 3960.0 772691.9 1951.2 File Copy 256 bufsize 500 maxblocks 1655.0 220721.2 1333.7 File Copy 4096 bufsize 8000 maxblocks 5800.0 1855948.5 3199.9 Pipe Throughput 12440.0 1759249.0 1414.2 Pipe-based Context Switching 4000.0 176311.6 440.8 Process Creation 126.0 10826.1 859.2 Shell Scripts (1 concurrent) 42.4 4587.4 1081.9 Shell Scripts (8 concurrent) 6.0 1574.0 2623.4 System Call Overhead 15000.0 2635416.8 1756.9 ======== System Benchmarks Index Score 1399.0 ------------------------------------------------------------------------ Benchmark Run: Fri Mar 31 2017 11:34:28 - 12:02:49 4 CPUs in system; running 4 parallel copies of tests Dhrystone 2 using register variables 123715157.4 lps (10.0 s, 7 samples) Double-Precision Whetstone 16699.7 MWIPS (9.9 s, 7 samples) Execl Throughput 16391.2 lps (30.0 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 760995.5 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 196730.3 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 2112305.0 KBps (30.0 s, 2 samples) Pipe Throughput 6115108.4 lps (10.0 s, 7 samples) Pipe-based Context Switching 985906.8 lps (10.0 s, 7 samples) Process Creation 33963.9 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 16102.3 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1461.9 lpm (60.1 s, 2 samples) System Call Overhead 7383143.8 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 123715157.4 10601.1 Double-Precision Whetstone 55.0 16699.7 3036.3 Execl Throughput 43.0 16391.2 3811.9 File Copy 1024 bufsize 2000 maxblocks 3960.0 760995.5 1921.7 File Copy 256 bufsize 500 maxblocks 1655.0 196730.3 1188.7 File Copy 4096 bufsize 8000 maxblocks 5800.0 2112305.0 3641.9 Pipe Throughput 12440.0 6115108.4 4915.7 Pipe-based Context Switching 4000.0 985906.8 2464.8 Process Creation 126.0 33963.9 2695.5 Shell Scripts (1 concurrent) 42.4 16102.3 3797.7 Shell Scripts (8 concurrent) 6.0 1461.9 2436.5 System Call Overhead 15000.0 7383143.8 4922.1 ======== System Benchmarks Index Score 3274.3 ======= Script description and score comparison completed! ======= 这个VPS怎么样,瓶颈在哪里?
    流星过雁7年前(2017-03-31)回复
  3. 微软 Azure国际版 最低配 ======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: AzureUbuntu: GNU/Linux OS: GNU/Linux -- 3.19.0-59-generic -- #66~14.04.1-Ubuntu SMP Fri May 13 17:27:10 UTC 2016 Machine: x86_64 (x86_64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz (4794.4 bogomips) x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET 05:35:15 up 2:03, 1 user, load average: 0.56, 0.17, 0.09; runlevel 2 ------------------------------------------------------------------------ Benchmark Run: Mon May 30 2016 05:35:15 - 06:03:20 1 CPU in system; running 1 parallel copy of tests Dhrystone 2 using register variables 31413940.8 lps (10.0 s, 7 samples) Double-Precision Whetstone 4110.0 MWIPS (9.4 s, 7 samples) Execl Throughput 5971.8 lps (30.0 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 1176607.0 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 314613.3 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 3323247.3 KBps (30.0 s, 2 samples) Pipe Throughput 2022146.5 lps (10.0 s, 7 samples) Pipe-based Context Switching 359623.2 lps (10.0 s, 7 samples) Process Creation 16421.5 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 9978.3 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1308.2 lpm (60.0 s, 2 samples) System Call Overhead 4217723.6 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 31413940.8 2691.9 Double-Precision Whetstone 55.0 4110.0 747.3 Execl Throughput 43.0 5971.8 1388.8 File Copy 1024 bufsize 2000 maxblocks 3960.0 1176607.0 2971.2 File Copy 256 bufsize 500 maxblocks 1655.0 314613.3 1901.0 File Copy 4096 bufsize 8000 maxblocks 5800.0 3323247.3 5729.7 Pipe Throughput 12440.0 2022146.5 1625.5 Pipe-based Context Switching 4000.0 359623.2 899.1 Process Creation 126.0 16421.5 1303.3 Shell Scripts (1 concurrent) 42.4 9978.3 2353.4 Shell Scripts (8 concurrent) 6.0 1308.2 2180.4 System Call Overhead 15000.0 4217723.6 2811.8 ======== System Benchmarks Index Score 1918.4 ======= Script description and score comparison completed! =======
    ssss8年前(2016-05-30)回复
  4. AWS的测试。。 BYTE UNIX Benchmarks (Version 5.1.3) System: ip-172-31-22-2: GNU/Linux OS: GNU/Linux -- 3.13.0-48-generic -- #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 Machine: x86_64 (x86_64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz (4789.1 bogomips) Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET 16:44:18 up 64 days, 7 min, 1 user, load average: 0.77, 0.33, 0.16; runlevel 2 ------------------------------------------------------------------------ Benchmark Run: Sun Jan 10 2016 16:44:18 - 17:12:22 1 CPU in system; running 1 parallel copy of tests Dhrystone 2 using register variables 31383571.7 lps (10.0 s, 7 samples) Double-Precision Whetstone 4034.6 MWIPS (9.7 s, 7 samples) Execl Throughput 4830.1 lps (30.0 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 1202472.6 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 323507.4 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 3499207.5 KBps (30.0 s, 2 samples) Pipe Throughput 2338733.1 lps (10.0 s, 7 samples) Pipe-based Context Switching 359816.5 lps (10.0 s, 7 samples) Process Creation 14954.2 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 8705.5 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1147.0 lpm (60.0 s, 2 samples) System Call Overhead 4206058.5 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 31383571.7 2689.3 Double-Precision Whetstone 55.0 4034.6 733.6 Execl Throughput 43.0 4830.1 1123.3 File Copy 1024 bufsize 2000 maxblocks 3960.0 1202472.6 3036.5 File Copy 256 bufsize 500 maxblocks 1655.0 323507.4 1954.7 File Copy 4096 bufsize 8000 maxblocks 5800.0 3499207.5 6033.1 Pipe Throughput 12440.0 2338733.1 1880.0 Pipe-based Context Switching 4000.0 359816.5 899.5 Process Creation 126.0 14954.2 1186.8 Shell Scripts (1 concurrent) 42.4 8705.5 2053.2 Shell Scripts (8 concurrent) 6.0 1147.0 1911.7 System Call Overhead 15000.0 4206058.5 2804.0 ======== System Benchmarks Index Score 1863.4 ======= Script description and score comparison completed! =======
    lam6408年前(2016-01-11)回复
  5. 好用,在用
    Andrew8年前(2016-01-03)回复
  6. 这个测试完了如何卸载呢?
    seiya9年前(2015-04-04)回复
  7. 这个跑完以后需要卸载吗,还是需要清理一些垃圾?
    流星过雁9年前(2014-11-21)回复
  8. 搞定了~~~~~ yum -y install gcc automake autoconf libtool make
    linspire10年前(2014-07-30)回复
  9. Complete! ./unixbench.sh: line 32: make: command not found Can't exec "make": No such file or directory at ./Run line 788. Can't exec "make": No such file or directory at ./Run line 790. ********************************************** Run: "make all" failed; aborting 出错啦,咋办啊,用的是centos 7的vps,新系统~~~~~~~~
    linspire10年前(2014-07-30)回复
  10. 所以国内的vps用不了
    adcen10年前(2014-06-17)回复
    • 感谢提醒,下载链接已经更换了。测试脚本已更新。
      秋水逸冰10年前(2014-06-17)回复
  11. 这个脚本是要到google下载东西的?google现在又你懂的。。。。。。。。。。
    adcen10年前(2014-06-17)回复