linux 性能测试UnixBench工具【转】

转自:https://blog.csdn.net/cojn52/article/details/89676228

性能测试。这里选择UnixBench工具进行性能测试。

下载地址:wget http://soft.laozuo.org/scripts/UnixBench5.1.3.tgz

如果出现需要安装验证 就去这个网站http://soft.laozuo.org找到scripts里的UnixBench5.1.3.tgz

 

1)安装使用 下面的脚本使用了最新版UnixBench5.1.3来测试,注释了关于graphic的测试项(大多数VPS都是没有显卡或者是集显,所以图像性能无需测试),运行10-30分钟后(根据CPU内核数量,运算时间不等)得出分数,越高越好。(提前将UnixBench5.1.3.tgz下载到了服务器的/root目录下了)

[root@test-vm001 ~]# cat bench.sh
#! /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;
mv /root/UnixBench5.1.3.tgz /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 '';
二、测试结果 执行后返回的测试结果类似如下(该性能测试脚本大概会运行10-30分钟,需耐心等待测结果):

[root@test-vm001 ~]# sh -x bench.sh
+ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin
+ export PATH
+ mkdir -p /opt/unixbench
+ mv /root/UnixBench5.1.3.tgz /opt/unixbench
+ cd /opt/unixbench
+ tar -xzf UnixBench5.1.3.tgz
+ cd UnixBench
+ yum -y install gcc gcc-c autoconf gcc-c++ time perl-Time-HiRes
.........
.........
make[1]: Leaving directory `/opt/unixbench/UnixBench'
sh: 3dinfo: command not found

# # # # # # # ##### ###### # # #### # #
# # ## # # # # # # # ## # # # # #
# # # # # # ## ##### ##### # # # # ######
# # # # # # ## # # # # # # # # #
# # # ## # # # # # # # ## # # # #
#### # # # # # ##### ###### # # #### # #

Version 5.1.3 Based on the Byte Magazine Unix Benchmark

Multi-CPU version Version 5 revisions by Ian Smith,
Sunnyvale, CA, USA
January 13, 2011 johantheghost at yahoo period com


1 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10

1 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10

1 x Execl Throughput 1 2 3

1 x File Copy 1024 bufsize 2000 maxblocks 1 2 3

1 x File Copy 256 bufsize 500 maxblocks 1 2 3

1 x File Copy 4096 bufsize 8000 maxblocks 1 2 3

1 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10

1 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10

1 x Process Creation 1 2 3

1 x System Call Overhead 1 2 3 4 5 6 7 8 9 10

1 x Shell Scripts (1 concurrent) 1 2 3

1 x Shell Scripts (8 concurrent) 1 2 3

========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)

System: test-vm001: GNU/Linux
OS: GNU/Linux -- 3.10.0-514.el7.x86_64 -- #1 SMP Tue Nov 22 16:42:41 UTC 2016
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz (4390.8 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
17:31:42 up 8:11, 6 users, load average: 0.14, 0.09, 0.06; runlevel 3

------------------------------------------------------------------------
Benchmark Run: 六 9月 16 2017 17:31:42 - 17:59:59
1 CPU in system; running 1 parallel copy of tests

Dhrystone 2 using register variables 31665236.6 lps (10.0 s, 7 samples)
Double-Precision Whetstone 4345.5 MWIPS (9.9 s, 7 samples)
Execl Throughput 4163.9 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 1091117.9 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 299689.6 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 2535441.2 KBps (30.0 s, 2 samples)
Pipe Throughput 1556494.1 lps (10.0 s, 7 samples)
Pipe-based Context Switching 362875.3 lps (10.0 s, 7 samples)
Process Creation 10440.1 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 5115.9 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 726.5 lpm (60.1 s, 2 samples)
System Call Overhead 2707740.8 lps (10.0 s, 7 samples)

System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 31665236.6 2713.4
Double-Precision Whetstone 55.0 4345.5 790.1
Execl Throughput 43.0 4163.9 968.3
File Copy 1024 bufsize 2000 maxblocks 3960.0 1091117.9 2755.3
File Copy 256 bufsize 500 maxblocks 1655.0 299689.6 1810.8
File Copy 4096 bufsize 8000 maxblocks 5800.0 2535441.2 4371.5
Pipe Throughput 12440.0 1556494.1 1251.2
Pipe-based Context Switching 4000.0 362875.3 907.2
Process Creation 126.0 10440.1 828.6
Shell Scripts (1 concurrent) 42.4 5115.9 1206.6
Shell Scripts (8 concurrent) 6.0 726.5 1210.8
System Call Overhead 15000.0 2707740.8 1805.2
========
System Benchmarks Index Score 1482.1

+ echo ''

+ echo ''

+ echo ''

+ echo '======= Script description and score comparison completed! ======= '
======= Script description and score comparison completed! =======
+ echo ''

+ echo ''

+ echo ''
注意:上面会有两个跑分结果,一个是 1 parallel process 的结果,另一个是4 parallel process 的结果 (具体可以看html里的输出)。两者的区别即一个是单进程跑,一个是多进程跑 。 默认测试完成后测试结果会存放在results目录,如下:

[root@test-vm001 results]# pwd
/opt/unixbench/UnixBench/results
[root@test-vm001 results]# ls
test-vm001-2017-09-16-01 test-vm001-2017-09-16-01.html test-vm001-2017-09-16-01.log
results目录中的三个文件,第一个是和上面脚本运行的结果一样;第二个html文件是将结果以页面的形式展示出来,可以使用浏览器打开查看;第三个log文件是运行过程中的详细测试过程部分。

三、测试项目分析

测试过程中每个项目后面会有1 2 3 4 5 6 7 8 9 10 数字,意思是进行了10组测试,测试过程中部分内容及解释如下:

1. ***********************
Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10
此项产生于 1984,测试 string handling,因为没有浮点操作,所以深受软件和硬件设计(hardware and software design)、编译和链接(compiler and linker options)、代码优化(code optimazaton)、对内存的cache(cache memory)、等待状态(?wait states)整数数据类型(integer data types)的影响
2. ********************
Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10
这一项测试浮点数操作的速度和效率。这一测试包括几个模块,每个模块都包括一组用于科学计算的操作。覆盖面很广的一系列c函数:sin,cos,sqrt,exp,log 被用于整数和浮点数的数学运算、数组访问、条件分支(conditional branch)和程序调用。此测试同时测试了整数和浮点数算术运算。
3. **************
System Call Overhead 1 2 3 4 5 6 7 8 9 10
测试进入和离开操作系统内核的代价,即一次系统调用的代价。它利用一个反复地调用 getpid 函数的小程序达到此目的。

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

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

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

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

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

Filesystem Throughput 1024 bufsize 2000 maxblocks 1 2 3

Filesystem Throughput 256 bufsize 500 maxblocks 1 2 3

Filesystem Throughput 4096 bufsize 8000 maxblocks 1 2 3

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

Shell Scripts (1 concurrent) 1 2 3
Shell Scripts (8 concurrent) 1 2 3
Shell Scripts (16 concurrent) 1 2 3
可以对多台服务器性能进行如上测试,然后对比上面9个测试参数的结果值

 

 

 

 

 

 

 

某某某 00000 16核处理器(4799.4 bogomips)
超线程,x86-64,MMX,AMD MMX,物理地址扩展,SYSENTER / SYSEXIT,AMD虚拟化,SYSCALL / SYSRET
基准运行:32个CPU; 1个并行过程
时间:11:39:40-12:07:53; 28分13秒
测试项目 项目说明 得分 单位 时间 线程 基准线 指数
Dhrystone 2 using register variables 测试 string handling 36409944.7 lps 10.0 s 7 116700 3120
Double-Precision Whetstone 测试浮点数操作的速度和效率 4444.2 MWIPS 10.4 s 7 55 808
Execl Throughput 此测试考察每秒钟可以执行的 execl 系统调用的次数 2945.6 lps 30.0 s 2 43 685
File Copy 1024 bufsize 2000 maxblocks 测试从一个文件向另外一个文件传输数据的速率。 732831.6 KBps 30.0 s 2 3960 1850.6
File Copy 256 bufsize 500 maxblocks 测试从一个文件向另外一个文件传输数据的速率。 208892.2 KBps 30.0 s 2 1655 1262.2
File Read 4096 bufsize 8000 maxblocks 测试从一个文件向另外一个文件传输数据的速率。 1498027.9 KBps 30.0 s 2 5800 2582.8
Pipe Throughput 一秒钟内一个进程可以向一个管道写 512 字节数据然后再读回的次数 1221308.3 lps 10.0 s 7 12440 981.8
Pipe-based Context Switching 测试两个进程(每秒钟)通过一个管道交换一个不断增长的整数的次数。 250427.1 lps 10.0 s 7 4000 626.1
Process Creation 测试每秒钟一个进程可以创建子进程然后收回子进程的次数(子进程一定立即退出)。 7041.7 lps 30.0 s 2 126 558.9
Shell Scripts (1 concurrent) 测试一秒钟内一个进程可以并发地开始一个shell 脚本的 n 个拷贝的次数,n 一般取值1 6175.8 lpm 60.0 s 2 42.4 1456.6
Shell Scripts (8 concurrent) 测试一秒钟内一个进程可以并发地开始一个shell 脚本的 n 个拷贝的次数,n 一般取值1,2,4,8. 3015.5 lpm 60.0 s 2 6 5025.8
System Call Overhead 测试进入和离开操作系统内核的代价,即一次系统调用的代价。 1960358.1 lps 10.0 s 7 15000 1306.9
系统基准指数得分: 1342.4


————————————————
版权声明:本文为CSDN博主「 junior1206」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/cojn52/article/details/89676228

posted @ 2022-06-29 15:37  Sky&Zhang  阅读(1340)  评论(0编辑  收藏  举报