searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

UnixBench性能测试工具使用指导

2023-06-16 09:42:03
1059
0

一、介绍   

UnixBench是一个类unix系统下的性能测试工具,一个开源工具,其测试能力包含系统调用、读写、进程、2D、3D、管道、运算等系统基准性能,会对系统CPU、内存、磁盘、网络等各个方面进行一系列的测试。然后将每个测试结果和基准值进行比较,得到一个索引值,所有测试项目的索引值结合在一起,形成一个测试分数值。被广泛用于测试linux系统性能领域。

二、使用指导

下载最新版本UnixBench5.1.3,

1、下载并解压:tar -zxvf UnixBench5.1.3.tgz

[root@VM-591 Unix]# tar -zxvf UnixBench5.1.3.tgz 
UnixBench/
UnixBench/README
UnixBench/src/
UnixBench/src/looper.c
******
[root@VM-591 Unix]# cd UnixBench
[root@VM-591 UnixBench]# ls
Makefile  pgms	README	results  Run  src  testdir  USAGE  WRITING_TESTS

2、安装依赖包(可通过yum源安装,也可以自己下载安装,此处忽略)

yum -y install make automake gcc autoconf gcc-c++ time perl-Time-HiRes

3、进入UnixBench目录,注释Makefile中的图形测试行

# GRAPHIC_TESTS = defined

4、编译安装:make

[root@VM-591 UnixBench]# make
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./results  exists
gcc -o ./pgms/arithoh -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Darithoh ./src/arith.c
gcc -o ./pgms/register -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum='register int' ./src/arith.c
gcc -o ./pgms/short -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=short ./src/arith.c
gcc -o ./pgms/int -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=int ./src/arith.c
*******

5、运行:./RUN

显示大写的UNIX BENCH表示运行起来了。全量运行时间大概半个小时。

其内部执行参数如下:./Run 模块 -i 迭代次数 -c 进程并发数 -q/-v (输出方式。

  • 模块:有时候你只想测某一个小程序的结果,那你可以修改自己去新增一个模块,修改测试内容,这对于调试是非常方便的,也可以直接指定某个执行程序。
  • 迭代次数:关于迭代次数,不能想当然的就理解成这就是要执行的次数了,默认框架分为两种迭代模式,一种是短迭代次数,默认 3次,一种是 长迭代次数,默认10 次。那输入的迭代次数就是默认的长迭代次数,短迭代次数=(迭代次数+1)/3,如果结果小于就是1. 程序配置好了,该选择哪个迭代次数。
  • 进程并发数:如果你想进程并发数不是系统CPU数,那就可以通过这个调整;
  • 输出方式:是静默还是详细输出方式;
模块包括:"dhry2reg", "whetstone-double", "execl", "fstime", "fsbuffer", "fsdisk", "pipe", "context1", "spawn", "shell1", "shell8","syscall"

./Run dhry2reg  ——CPU 1线程字符串计算能力

./Run whetstone-double -c 4——CPU 4线程浮点计算能力

./Run -c 4 ——CPU 4线程处理能力

 

[root@VM-782 UnixBench]# ./Run 
make all
make[1]: Entering directory '/root/UnixBench'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/root/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: VM-782: GNU/Linux
   OS: GNU/Linux -- 4.18.0-80.el8.x86_64 -- #1 SMP Tue Jun 4 09:19:46 UTC 2019
   Machine: x86_64 (x86_64)
中间省略
------------------------------------------------------------------------
Benchmark Run: Fri Jun 16 2023 15:56:20 - 16:24:30
32 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       50664878.0 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     7767.2 MWIPS (9.0 s, 7 samples)
Execl Throughput                               6965.1 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1664261.7 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          467750.5 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       4679303.6 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2456830.4 lps   (10.1 s, 7 samples)
Pipe-based Context Switching                 287301.5 lps   (10.0 s, 7 samples)
Process Creation                               9483.6 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   8548.7 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   4307.9 lpm   (60.0 s, 2 samples)
System Call Overhead                        2360948.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   50664878.0   4341.5
Double-Precision Whetstone                       55.0       7767.2   1412.2
Execl Throughput                                 43.0       6965.1   1619.8
File Copy 1024 bufsize 2000 maxblocks          3960.0    1664261.7   4202.7
File Copy 256 bufsize 500 maxblocks            1655.0     467750.5   2826.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    4679303.6   8067.8
Pipe Throughput                               12440.0    2456830.4   1974.9
Pipe-based Context Switching                   4000.0     287301.5    718.3
Process Creation                                126.0       9483.6    752.7
Shell Scripts (1 concurrent)                     42.4       8548.7   2016.2
Shell Scripts (8 concurrent)                      6.0       4307.9   7179.8
System Call Overhead                          15000.0    2360948.7   [111195.012545] serial8250: too much work for irq4
1574.0
                                                                   ========
System Benchmarks Index Score                                        2310.5

------------------------------------------------------------------------
Benchmark Run: Fri Jun 16 2023 16:24:30 - 16:24:30
32 CPUs in system; running 32 parallel copies of tests

 

三、结果分析

测试项 项目说明 基准线
Dhrystone 2 using register variables 测试string handing 116700.0Ips
Double-Precision Whetstone 测试浮点数操作的速度和效率 55.0MWIPS
Execl Throughput 每秒钟可以执行的excel系统调用的次数 43.0lps
File Copy 1024 bufsize 2000 maxblocks 从一个文件向另外一个文件传输数据的速率 3960.0KBps
File Copy 256 bufsize 500 maxblocks 从一个文件向另外一个文件传输数据的速率 1655.0KBps
File Copy 4096 bufsize 8000 maxblocks 从一个文件向另外一个文件传输数据的速率 5800.0KBps
Pipe Throughput 测试两个进程每秒钟通过一个管道交换一个不断增长的整数的次数 12440.0lps
Pipe-based Context Switching 一秒钟内一个进程可以向一个管道写512字节数据然后再读回的次数 4000.0lps
Process Creation 每秒钟一个进程可以创建子进程然后收回子进程的次数 126.0lps
Shell Scripts (8 concurrent) 一秒内一个进程可以并发的开始一个shell脚本的n个拷贝的次数,n一般取值1、2、4、8 6.0lpm
System Call Overhead 测试进入和离开操作系统内核的代价,即一次系统调用的代价 15000.0lpm

 

四、常见错误

1.缺少gcc或c++

yum install gcc gcc_c++

2.报错如/src/ubgears.c:48:22: error: X11/Xlib.h: No such file or directory

./src/ubgears.c:49:23: error: X11/Xutil.h: No such file or directory

./src/ubgears.c:50:24: error: X11/keysym.h: No such file or directory

./src/ubgears.c:51:19: error: GL/gl.h: No such file or directory

./src/ubgears.c:52:20: error: GL/glx.h: No such file or directory

yum install xorg-x11*

3.报错如/usr/bin/ld: cannot find -lXext

ln -s /usr/lib64/libXext.so.6.4.0 /usr/lib/libXext.so

4.Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./Run line 6. BEGIN failed--compilation aborted at ./Run line 6.

yum install perl-Time-HiRes

0条评论
0 / 1000
Miya
2文章数
0粉丝数
Miya
2 文章 | 0 粉丝
Miya
2文章数
0粉丝数
Miya
2 文章 | 0 粉丝
原创

UnixBench性能测试工具使用指导

2023-06-16 09:42:03
1059
0

一、介绍   

UnixBench是一个类unix系统下的性能测试工具,一个开源工具,其测试能力包含系统调用、读写、进程、2D、3D、管道、运算等系统基准性能,会对系统CPU、内存、磁盘、网络等各个方面进行一系列的测试。然后将每个测试结果和基准值进行比较,得到一个索引值,所有测试项目的索引值结合在一起,形成一个测试分数值。被广泛用于测试linux系统性能领域。

二、使用指导

下载最新版本UnixBench5.1.3,

1、下载并解压:tar -zxvf UnixBench5.1.3.tgz

[root@VM-591 Unix]# tar -zxvf UnixBench5.1.3.tgz 
UnixBench/
UnixBench/README
UnixBench/src/
UnixBench/src/looper.c
******
[root@VM-591 Unix]# cd UnixBench
[root@VM-591 UnixBench]# ls
Makefile  pgms	README	results  Run  src  testdir  USAGE  WRITING_TESTS

2、安装依赖包(可通过yum源安装,也可以自己下载安装,此处忽略)

yum -y install make automake gcc autoconf gcc-c++ time perl-Time-HiRes

3、进入UnixBench目录,注释Makefile中的图形测试行

# GRAPHIC_TESTS = defined

4、编译安装:make

[root@VM-591 UnixBench]# make
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./results  exists
gcc -o ./pgms/arithoh -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Darithoh ./src/arith.c
gcc -o ./pgms/register -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum='register int' ./src/arith.c
gcc -o ./pgms/short -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=short ./src/arith.c
gcc -o ./pgms/int -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=int ./src/arith.c
*******

5、运行:./RUN

显示大写的UNIX BENCH表示运行起来了。全量运行时间大概半个小时。

其内部执行参数如下:./Run 模块 -i 迭代次数 -c 进程并发数 -q/-v (输出方式。

  • 模块:有时候你只想测某一个小程序的结果,那你可以修改自己去新增一个模块,修改测试内容,这对于调试是非常方便的,也可以直接指定某个执行程序。
  • 迭代次数:关于迭代次数,不能想当然的就理解成这就是要执行的次数了,默认框架分为两种迭代模式,一种是短迭代次数,默认 3次,一种是 长迭代次数,默认10 次。那输入的迭代次数就是默认的长迭代次数,短迭代次数=(迭代次数+1)/3,如果结果小于就是1. 程序配置好了,该选择哪个迭代次数。
  • 进程并发数:如果你想进程并发数不是系统CPU数,那就可以通过这个调整;
  • 输出方式:是静默还是详细输出方式;
模块包括:"dhry2reg", "whetstone-double", "execl", "fstime", "fsbuffer", "fsdisk", "pipe", "context1", "spawn", "shell1", "shell8","syscall"

./Run dhry2reg  ——CPU 1线程字符串计算能力

./Run whetstone-double -c 4——CPU 4线程浮点计算能力

./Run -c 4 ——CPU 4线程处理能力

 

[root@VM-782 UnixBench]# ./Run 
make all
make[1]: Entering directory '/root/UnixBench'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[1]: Leaving directory '/root/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: VM-782: GNU/Linux
   OS: GNU/Linux -- 4.18.0-80.el8.x86_64 -- #1 SMP Tue Jun 4 09:19:46 UTC 2019
   Machine: x86_64 (x86_64)
中间省略
------------------------------------------------------------------------
Benchmark Run: Fri Jun 16 2023 15:56:20 - 16:24:30
32 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       50664878.0 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     7767.2 MWIPS (9.0 s, 7 samples)
Execl Throughput                               6965.1 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1664261.7 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          467750.5 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       4679303.6 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2456830.4 lps   (10.1 s, 7 samples)
Pipe-based Context Switching                 287301.5 lps   (10.0 s, 7 samples)
Process Creation                               9483.6 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   8548.7 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   4307.9 lpm   (60.0 s, 2 samples)
System Call Overhead                        2360948.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   50664878.0   4341.5
Double-Precision Whetstone                       55.0       7767.2   1412.2
Execl Throughput                                 43.0       6965.1   1619.8
File Copy 1024 bufsize 2000 maxblocks          3960.0    1664261.7   4202.7
File Copy 256 bufsize 500 maxblocks            1655.0     467750.5   2826.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    4679303.6   8067.8
Pipe Throughput                               12440.0    2456830.4   1974.9
Pipe-based Context Switching                   4000.0     287301.5    718.3
Process Creation                                126.0       9483.6    752.7
Shell Scripts (1 concurrent)                     42.4       8548.7   2016.2
Shell Scripts (8 concurrent)                      6.0       4307.9   7179.8
System Call Overhead                          15000.0    2360948.7   [111195.012545] serial8250: too much work for irq4
1574.0
                                                                   ========
System Benchmarks Index Score                                        2310.5

------------------------------------------------------------------------
Benchmark Run: Fri Jun 16 2023 16:24:30 - 16:24:30
32 CPUs in system; running 32 parallel copies of tests

 

三、结果分析

测试项 项目说明 基准线
Dhrystone 2 using register variables 测试string handing 116700.0Ips
Double-Precision Whetstone 测试浮点数操作的速度和效率 55.0MWIPS
Execl Throughput 每秒钟可以执行的excel系统调用的次数 43.0lps
File Copy 1024 bufsize 2000 maxblocks 从一个文件向另外一个文件传输数据的速率 3960.0KBps
File Copy 256 bufsize 500 maxblocks 从一个文件向另外一个文件传输数据的速率 1655.0KBps
File Copy 4096 bufsize 8000 maxblocks 从一个文件向另外一个文件传输数据的速率 5800.0KBps
Pipe Throughput 测试两个进程每秒钟通过一个管道交换一个不断增长的整数的次数 12440.0lps
Pipe-based Context Switching 一秒钟内一个进程可以向一个管道写512字节数据然后再读回的次数 4000.0lps
Process Creation 每秒钟一个进程可以创建子进程然后收回子进程的次数 126.0lps
Shell Scripts (8 concurrent) 一秒内一个进程可以并发的开始一个shell脚本的n个拷贝的次数,n一般取值1、2、4、8 6.0lpm
System Call Overhead 测试进入和离开操作系统内核的代价,即一次系统调用的代价 15000.0lpm

 

四、常见错误

1.缺少gcc或c++

yum install gcc gcc_c++

2.报错如/src/ubgears.c:48:22: error: X11/Xlib.h: No such file or directory

./src/ubgears.c:49:23: error: X11/Xutil.h: No such file or directory

./src/ubgears.c:50:24: error: X11/keysym.h: No such file or directory

./src/ubgears.c:51:19: error: GL/gl.h: No such file or directory

./src/ubgears.c:52:20: error: GL/glx.h: No such file or directory

yum install xorg-x11*

3.报错如/usr/bin/ld: cannot find -lXext

ln -s /usr/lib64/libXext.so.6.4.0 /usr/lib/libXext.so

4.Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./Run line 6. BEGIN failed--compilation aborted at ./Run line 6.

yum install perl-Time-HiRes

文章来自个人专栏
云主机的那些事
2 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
0
0