0


UnixBench测试工具学习

UnixBench测试工具学习

UnixBench通过一系列综合测试来评估CPU性能,包括单任务、多任务、并行处理能力等方面。UnixBench是一个广泛使用的基准测试工具,它可以帮助用户了解和比较不同系统的性能。能够通过一系列的测试,去测量系统的多个方面,包括CPU、内存、磁盘I/O和图形渲染等方面的性能体现,主要测试系统的 CPU 性能、内存性能、文件系统性能等方面。

1.主要特点

  • Dhrystone测试:这个测试聚焦在字符串处理能力,没有浮点运算操作。它主要用于测试链接器编译、代码优化、内存缓存、等待状态和整数数据类型等,其中硬件和软件设计都会影响测试结果。Dhrystone是一个用于测量整数运算性能的基准测试。它主要测试一台计算机在单位时间内能够执行多少次简单的整数运算。
  • Whetstone测试:这项测试用于评估浮点运算的效率和速度,包含科学计算的典型性能模块,如C语言中的sin、cos、sqrt等数学函数,以及数组访问、条件分支和过程调用等操作。Whetstone是一个浮点运算性能的基准测试。它主要测试一台计算机在单位时间内能够执行多少次浮点运算。
  • Execl Throughput测试:这是一个综合性的测试,用来衡量系统的整体性能。execl测试通过创建子进程并调用exec系统调用来测试系统的进程创建和执行性能
  • pipe:pipe测试通过创建管道并进行进程间通信来测试系统的管道性能。
  • 文件复制:UnixBench还包括文件复制测试,用于测试系统在进行文件复制操作时的性能。
  • 2D图形渲染:UnixBench包括对2D图形性能的测试,用于测试系统在处理2D图形时的性能。
  • 3D图形渲染:UnixBench还包括对3D图形性能的测试,用于测试系统在处理3D图形时的性能。

2.Unixbench安装

  1. 下载UnixBench您可以从UnixBench的GitHub存储库中获取源代码。使用以下命令克隆存储库:git clone https://github.com/kdlucas/byte-unixbench.git

  2. 进入UnixBench目录使用以下命令进入UnixBench目录:cd byte-unixbench/UnixBench

  3. 编译UnixBench运行./Run脚本来编译UnixBench:./Run

  4. 运行UnixBench编译完成后,您可以运行UnixBench进行性能测试:./Run#可以使用-c参数指定要运行的测试项目./Run -c dhrystone#一次性运行多个测试项目./Run -c dhrystone,whetstone,execl,pipe,fileio,2d,3d

  5. 查看结果UnixBench运行完毕后,unixBench会生成一个结果文件,通常是/tmp/UnixBench

结果示例:
#    #  #    #  #  #    #          #####   ######  #    #   ####   #    ##    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    ##    #  # #  #  #    ##            #####   #####   # #  #  #       #######    #  #  # #  #    ##            #    #  #       #  # #  #       #    ##    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #####   #    #  #  #    #          #####   ######  #    #   ####   #    ##这一行是UnixBench的标志性ASCII艺术字

   Version 5.1.3                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      
   January 30, 2024                  johantheghost at yahoo period com

#单核心Dhrystone测试,使用寄存器变量,重复运行10次。
1 x Dhrystone 2 using register variables  1 2 3 4 5 6 7 8 9 10

#单核心双精度Whetstone测试,重复运行10次。
1 x Double-Precision Whetstone  1 2 3 4 5 6 7 8 9 10

#单核心execl吞吐量测试,重复运行3次。
1 x Execl Throughput  1 2 3

#单核心文件复制测试,缓冲区大小1024,最大块数2000,重复运行3次。
1 x File Copy 1024 bufsize 2000 maxblocks  1 2 3

#单核心文件复制测试,缓冲区大小256,最大块数500,重复运行3次。
1 x File Copy 256 bufsize 500 maxblocks  1 2 3

#单核心文件复制测试,缓冲区大小4096,最大块数8000,重复运行3次。
1 x File Copy 4096 bufsize 8000 maxblocks  1 2 3

#单核心管道吞吐量测试,重复运行10次。
1 x Pipe Throughput  1 2 3 4 5 6 7 8 9 10

#单核心基于管道的上下文切换测试,重复运行10次。
1 x Pipe-based Context Switching  1 2 3 4 5 6 7 8 9 10

#单核心进程创建测试,重复运行3次。
1 x Process Creation  1 2 3

#单核心系统调用开销测试,重复运行10次。
1 x System Call Overhead  1 2 3 4 5 6 7 8 9 10

#单核心并发Shell脚本测试,重复运行3次。
1 x Shell Scripts (1 concurrent)  1 2 3

#单核心8个并发Shell脚本测试,重复运行3次。
1 x Shell Scripts (8 concurrent)  1 2 3

#双核心Dhrystone测试,使用寄存器变量,重复运行10次。
2 x Dhrystone 2 using register variables  1 2 3 4 5 6 7 8 9 10

#双核心双精度Whetstone测试,重复运行10次。
2 x Double-Precision Whetstone  1 2 3 4 5 6 7 8 9 10

#双核心execl吞吐量测试,重复运行3次。
2 x Execl Throughput  1 2 3

2 x File Copy 1024 bufsize 2000 maxblocks  1 2 3

2 x File Copy 256 bufsize 500 maxblocks  1 2 3

2 x File Copy 4096 bufsize 8000 maxblocks  1 2 3

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

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

2 x Process Creation  1 2 3

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

2 x Shell Scripts (1 concurrent)  1 2 3

2 x Shell Scripts (8 concurrent)  1 2 3

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)
   #系统信息介绍System:example.com: GNU/Linux
   OS: GNU/Linux -- 4.4.0-142-generic --#168-Ubuntu SMP Wed Jan 30 21:00:45 UTC 2024Machine: 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 (4788.0 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   CPU 1: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz (4788.0 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   09:32:28 up 2 min,  1 user,load average:0.17,0.15, 0.06; runlevel 5

------------------------------------------------------------------------Benchmark Run: Mon Jun 10 2024 09:32:28 -10:00:54
2 CPUs in system; running 1 parallel copy of tests
/*
lps: 每秒钟的运算次数(Loops Per Second)。
MWIPS: 每秒钟的百万次浮点运算数(Million Whetstone Instructions Per Second)。
KBps: 每秒钟的千字节数据传输速度(Kilobytes Per Second)。
lpm: 每分钟的Shell脚本执行次数(Loops Per Minute)。
BASELINE: 基准性能指标。
INDEX: 索引值,表示相对于基准性能的倍数。

*/#10.0 s:每次测试运行的持续时间为10秒。#7 samples:共进行了7次测试样本的采样。
Dhrystone 2 using register variables       43703086.4 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     5403.6 MWIPS (9.8 s, 7 samples)
Execl Throughput                               4256.3 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        896394.0 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          255959.8 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1865040.3 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1473405.9 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 286255.0 lps   (10.0 s, 7 samples)
Process Creation                               9703.0 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   4702.9 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    674.6 lpm   (60.0 s, 2 samples)
System Call Overhead                        1720054.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   43703086.4   3742.8
Double-Precision Whetstone                       55.0       5403.6    982.6
Execl Throughput                                 43.0       4256.3    989.1
File Copy 1024 bufsize 2000 maxblocks          3960.0     896394.0   2264.8
File Copy 256 bufsize 500 maxblocks            1655.0     255959.8   1546.5
File Copy 4096 bufsize 8000 maxblocks          5800.0    1865040.3   3214.6
Pipe Throughput                               12440.0    1473405.9   1184.2
Pipe-based Context Switching                   4000.0     286255.0    715.6
Process Creation                                126.0       9703.0    770.4
Shell Scripts (1 concurrent)                     42.4       4702.9   1109.8
Shell Scripts (8 concurrent)                      6.0        674.6   1124.3
System Call Overhead                          15000.0    1720054.7   1146.7
                                                                   ========
System Benchmarks Index Score                                         1357.0

------------------------------------------------------------------------Benchmark Run: Mon Jun 10 2024 10:00:54 -10:29:16
2 CPUs in system; running 2 parallel copies of tests
/*
lps: 每秒钟的运算次数(Loops Per Second)。
MWIPS: 每秒钟的百万次浮点运算数(Million Whetstone Instructions Per Second)。
KBps: 每秒钟的千字节数据传输速度(Kilobytes Per Second)。
lpm: 每分钟的Shell脚本执行次数(Loops Per Minute)。
BASELINE: 基准性能指标。
INDEX: 索引值,表示相对于基准性能的倍数。
*/

Dhrystone 2 using register variables       87867472.8 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    10894.1 MWIPS (9.9 s, 7 samples)
Execl Throughput                               8757.1 lps   (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1662187.5 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          459080.3 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2979254.9 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2978955.5 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 575437.4 lps   (10.0 s, 7 samples)
Process Creation                              19845.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  10139.0 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1418.2 lpm   (60.0 s, 2 samples)
System Call Overhead                        3565365.4 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   87867472.8   7531.0
Double-Precision Whetstone                       55.0      10894.1   1981.7
Execl Throughput                                 43.0       8757.1   2033.5
File Copy 1024 bufsize 2000 maxblocks          3960.0    1662187.5   4198.0
File Copy 256 bufsize 500 maxblocks            1655.0     459080.3   2773.7
File Copy 4096 bufsize 8000 maxblocks          5800.0    2979254.9   5133.2
Pipe Throughput                               12440.0    2978955.5   2393.6
Pipe-based Context Switching                   4000.0     575437.4   1438.6
Process Creation                                126.0      19845.4   1574.4
Shell Scripts (1 concurrent)                     42.4      10139.0   2391.4
Shell Scripts (8 concurrent)                      6.0       1418.2   2363.7
System Call Overhead                          15000.0    3565365.4   2376.9
                                                                   ========
System Benchmarks Index Score                                         2564.6
测试结果分析
  1. 测试环境分析:首先了解测试结果所对应的系统环境。从结果中可以看到,测试的系统是一台基于Intel Xeon CPU E5-2676 v3的双CPU系统,运行的是Linux操作系统,内核版本为4.4.0-142-generic。
  2. 单CPU性能测试:在单CPU性能测试中可以看到以下几项测试结果:- Dhrystone性能测试结果为43703086.4 lps,表明系统在整数运算性能上的表现较好。- Whetstone性能测试结果为5403.6 MWIPS,表明系统在浮点运算性能上的表现也较好。- Execl Throughput性能测试结果为4256.3 lps,反映了系统在进程创建和执行方面的性能。这结果显示系统在单CPU运算性能和进程创建方面的表现。
  3. 文件复制性能测试:文件复制性能测试包括了不同大小的文件复制速度。从结果中可以看到:- 文件复制1024 bufsize 2000 maxblocks的速度为896394.0 KBps。- 文件复制256 bufsize 500 maxblocks的速度为255959.8 KBps。- 文件复制4096 bufsize 8000 maxblocks的速度为1865040.3 KBps。这些结果反映系统在不同块大小下的文件复制速度,可以用来评估系统的磁盘I/O性能。
  4. 管道性能测试:管道性能测试包括了管道传输速度和基于管道的上下文切换速度。从结果中可以看到:- 管道传输速度为1473405.9 lps。- 基于管道的上下文切换速度为286255.0 lps。这些结果反映系统在管道通信和上下文切换方面的性能。
  5. 多CPU性能测试:在双CPU性能测试中,结果显示系统在双CPU情况下的性能表现。例如,在Dhrystone测试中,性能提高到了87867472.8 lps,反映了双CPU对系统性能的提升。
  6. 综合评估:根据上述结果,我们可以综合评估系统的性能表现。例如,系统在整数和浮点运算性能上表现较好,但在文件复制和管道通信等方面可能有改进空间。根据具体需求,可以采取相应的优化措施,如优化文件系统、升级硬盘、调整管道通信策略等,以提升系统的性能。

本文转载自: https://blog.csdn.net/weixin_40539956/article/details/137255387
版权归原作者 秋月霜风 所有, 如有侵权,请联系我们删除。

“UnixBench测试工具学习”的评论:

还没有评论