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内核数量,运算时间不等)得出分数,越高越好。
#! /bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=============================================================================================== # Description: Unixbench for Test #=============================================================================================== # Create new soft download dir mkdir -p /opt/unixbench; cd /opt/unixbench; # Download UnixBench5.1.3 if [ -s UnixBench5.1.3.tgz ]; then echo "UnixBench5.1.3.tgz [found]" else echo "UnixBench5.1.3.tgz not found!!!download now......" if ! wget -c http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz;then echo "Failed to download UnixBench5.1.3.tgz,please download it to "/opt/unixbench" directory manually and rerun the install script." exit 1 fi fi tar -xzf UnixBench5.1.3.tgz; cd UnixBench; yum -y install gcc gcc-c autoconf gcc-c++ time perl-Time-HiRes #Run unixbench sed -i "s/GRAPHIC_TESTS = defined/#GRAPHIC_TESTS = defined/g" ./Makefile make; ./Run; echo ''; echo ''; echo ''; echo "======= Script description and score comparison completed! ======= "; echo ''; echo ''; echo '';
上面的脚本包含了下载安装和自动运行 。目前该脚本我已经放到我的github项目上面,可以直接wget下载执行。
#wget https://raw.githubusercontent.com/361way/unixbench/master/unixbench.sh #sh unixbench.sh
二、测试结果
执行后返回的测试结果类似如下:
======================================================================== BYTE UNIX Benchmarks (Version 5.1.3) System: localhost.localdomain: GNU/Linux OS: GNU/Linux -- 2.6.32-431.17.1.el6.x86_64 -- #1 SMP Wed May 7 23:32:49 UTC 2014 Machine: x86_64 (x86_64) Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8") CPU 0: Intel(R) Xeon(R) CPU E5504 @ 2.00GHz (4000.1 bogomips) Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET CPU 1: Intel(R) Xeon(R) CPU E5504 @ 2.00GHz (4000.1 bogomips) Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET CPU 2: Intel(R) Xeon(R) CPU E5504 @ 2.00GHz (4000.1 bogomips) Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET CPU 3: Intel(R) Xeon(R) CPU E5504 @ 2.00GHz (4000.1 bogomips) Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET 23:36:57 up 4:20, 0 users, load average: 1.03, 0.65, 0.35; runlevel unknown ------------------------------------------------------------------------ Benchmark Run: Mon Jun 09 2014 23:36:57 - 00:04:51 4 CPUs in system; running 1 parallel copy of tests Dhrystone 2 using register variables 18840611.8 lps (10.0 s, 7 samples) Double-Precision Whetstone 2362.5 MWIPS (10.0 s, 7 samples) Execl Throughput 1957.2 lps (30.0 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 527279.8 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 154228.9 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 1235516.5 KBps (30.0 s, 2 samples) Pipe Throughput 1217279.3 lps (10.0 s, 7 samples) Pipe-based Context Switching 24797.2 lps (10.0 s, 7 samples) Process Creation 5322.7 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 3299.6 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1146.1 lpm (60.0 s, 2 samples) System Call Overhead 2702182.3 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 18840611.8 1614.4 Double-Precision Whetstone 55.0 2362.5 429.6 Execl Throughput 43.0 1957.2 455.2 File Copy 1024 bufsize 2000 maxblocks 3960.0 527279.8 1331.5 File Copy 256 bufsize 500 maxblocks 1655.0 154228.9 931.9 File Copy 4096 bufsize 8000 maxblocks 5800.0 1235516.5 2130.2 Pipe Throughput 12440.0 1217279.3 978.5 Pipe-based Context Switching 4000.0 24797.2 62.0 Process Creation 126.0 5322.7 422.4 Shell Scripts (1 concurrent) 42.4 3299.6 778.2 Shell Scripts (8 concurrent) 6.0 1146.1 1910.2 System Call Overhead 15000.0 2702182.3 1801.5 ======== System Benchmarks Index Score 787.9 ------------------------------------------------------------------------ Benchmark Run: Tue Jun 10 2014 00:04:51 - 00:33:18 4 CPUs in system; running 4 parallel copies of tests Dhrystone 2 using register variables 61686020.3 lps (10.0 s, 7 samples) Double-Precision Whetstone 8888.7 MWIPS (9.8 s, 7 samples) Execl Throughput 6695.9 lps (29.9 s, 2 samples) File Copy 1024 bufsize 2000 maxblocks 545098.4 KBps (30.0 s, 2 samples) File Copy 256 bufsize 500 maxblocks 143868.5 KBps (30.0 s, 2 samples) File Copy 4096 bufsize 8000 maxblocks 1447141.0 KBps (30.0 s, 2 samples) Pipe Throughput 3875650.9 lps (10.0 s, 7 samples) Pipe-based Context Switching 764302.1 lps (10.0 s, 7 samples) Process Creation 18793.6 lps (30.0 s, 2 samples) Shell Scripts (1 concurrent) 8797.7 lpm (60.0 s, 2 samples) Shell Scripts (8 concurrent) 1582.7 lpm (60.1 s, 2 samples) System Call Overhead 6719333.2 lps (10.0 s, 7 samples) System Benchmarks Index Values BASELINE RESULT INDEX Dhrystone 2 using register variables 116700.0 61686020.3 5285.9 Double-Precision Whetstone 55.0 8888.7 1616.1 Execl Throughput 43.0 6695.9 1557.2 File Copy 1024 bufsize 2000 maxblocks 3960.0 545098.4 1376.5 File Copy 256 bufsize 500 maxblocks 1655.0 143868.5 869.3 File Copy 4096 bufsize 8000 maxblocks 5800.0 1447141.0 2495.1 Pipe Throughput 12440.0 3875650.9 3115.5 Pipe-based Context Switching 4000.0 764302.1 1910.8 Process Creation 126.0 18793.6 1491.6 Shell Scripts (1 concurrent) 42.4 8797.7 2074.9 Shell Scripts (8 concurrent) 6.0 1582.7 2637.9 System Call Overhead 15000.0 6719333.2 4479.6 ======== System Benchmarks Index Score 2128.5 ======= Script description and score comparison completed! =======
注:上面会有两个跑分结果,一个是 1 parallel process 的结果,另一个是4 parallel process 的结果 (具体可以看html里的输出)。两者的区别即一个是单进程跑,一个是多进程跑 。
默认测试完成后测试结果会存放在results目录,如下:
[root@361way results]# pwd /opt/unixbench/UnixBench/results [root@361way results]# ls 361way.com-2014-06-06-01 361way.com-2014-06-06-01.html 361way.com-2014-06-06-01.log
results目录中的三个文件,第一个是和上面贴出的结果一样;第二个html文件是将结果以页面的形式展示出来,可以使用浏览器打开查看;第三个log文件是运行过程中的详细测试过程部分。
三、测试项目分析
测试过程中每个项目后面会有1 2 3 4 5 6 7 8 9 10 数字,意思是进行了10组测试,测试过程中部分内容及解释如下: