一、UnixBench
Git源码:https://github.com/kdlucas/byte-unixbench/
UnixBench是1983年在莫纳什大学首次启动的一个简单的综合基准测试应用程序,这些测试通过将Unix系统的结果与在基准系统(SPARCstation 20-61(评级为10.0))上运行代码所设置的一组分数进行比较,从而获取到系统各项测试得分和综合性能得分。这个得分值是测试系统测试结果与一个基线系统测试结果比较得到的指数值,比如:一个系统的测试得分为1000,则意味着该系统比基准系统(SPARCstation 20-61)运行快100倍。
UnixBench作为一个基于系统的基准测试工具,测试结果不仅仅取决于CPU、内存或磁盘,也取决于系统、开发库甚至编译器。UnixBench默认运行测试两次:一次基于一个进程单任务性能测试,另外一次基于N个进程(N为CPU个数)多任务并行的性能测试。测试项包括:
- Dhrystone 2 using register variables
- Double-Precision Whetstone
- Execl Throughput
- File Copy 1024 bufsize 2000 maxblocks
- File Copy 256 bufsize 500 maxblocks
- File Copy 4096 bufsize 8000 maxblocks
- Pipe Throughput
- Pipe-based Context Switching
- Process Creation
- System Call Overhead
- Shell Scripts (1 concurrent)
- Shell Scripts (8 concurrent)
参考链接:
https://developer.aliyun.com/article/674728
1、安装
当前(2023.09.30)最新版本为v5.1.3
root@ubuntu:$ git clone https://github.com/kdlucas/byte-unixbench -b v5.1.3
或者:
root@ubuntu:$ wget https://github.com/kdlucas/byte-unixbench/archive/refs/tags/v5.1.3.tar.gz
root@ubuntu:$ tar -zxvf v5.1.3.tar.gz
进入安装后的目录,可以看到一下文件
root@ubuntu:$ cd byte-unixbench-5.1.3/UnixBench
root@ubuntu:$ tree -L 1
.
├── Makefile
├── pgms
├── README
├── Run
├── src
├── testdir
├── USAGE
└── WRITING_TESTS
执行make编译,命令执行成功后可以获取该平台可运行的binaray文件。
root@ubuntu:$ make
注:如果执行make有报错信息,需要根据提示对应解决。
2、运行
root@ubuntu:$ ./Run
运行大概需要花费1个小时的时间,运行完成后可以看到类似以下的输出:
# # # # # # # ##### ###### # # #### # #
# # ## # # # # # # # ## # # # # #
# # # # # # ## ##### ##### # # # # ######
# # # # # # ## # # # # # # # # #
# # # ## # # # # # # # ## # # # #
#### # # # # # ##### ###### # # #### # #
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
4 x Dhrystone 2 using register variables 1 2 3 4 5 6 7 8 9 10
4 x Double-Precision Whetstone 1 2 3 4 5 6 7 8 9 10
4 x Execl Throughput 1 2 3
4 x File Copy 1024 bufsize 2000 maxblocks 1 2 3
4 x File Copy 256 bufsize 500 maxblocks 1 2 3
4 x File Copy 4096 bufsize 8000 maxblocks 1 2 3
4 x Pipe Throughput 1 2 3 4 5 6 7 8 9 10
4 x Pipe-based Context Switching 1 2 3 4 5 6 7 8 9 10
4 x Process Creation 1 2 3
4 x System Call Overhead 1 2 3 4 5 6 7 8 9 10
4 x Shell Scripts (1 concurrent) 1 2 3
4 x Shell Scripts (8 concurrent) 1 2 3
========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)
System: ubuntu: GNU/Linux
OS: GNU/Linux -- 5.15.0-69-generic -- #76~20.04.1-Ubuntu SMP Mon Mar 20 15:54:19 UTC 2023
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (7392.0 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 1: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (7392.0 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 2: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (7392.0 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 3: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (7392.0 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
20:44:03 up 51 min, 2 users, load average: 0.24, 0.18, 0.18; runlevel 5
------------------------------------------------------------------------
Benchmark Run: Sat Sep 30 2023 20:44:03 - 21:12:03
4 CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 49764909.8 lps (10.0 s, 7 samples)
Double-Precision Whetstone 7674.2 MWIPS (9.8 s, 7 samples)
Execl Throughput 880.3 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 558807.1 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 147747.3 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 1626154.1 KBps (30.0 s, 2 samples)
Pipe Throughput 694372.9 lps (10.0 s, 7 samples)
Pipe-based Context Switching 38287.1 lps (10.0 s, 7 samples)
Process Creation 3996.4 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 5329.5 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 1652.7 lpm (60.0 s, 2 samples)
System Call Overhead 376172.8 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 49764909.8 4264.3
Double-Precision Whetstone 55.0 7674.2 1395.3
Execl Throughput 43.0 880.3 204.7
File Copy 1024 bufsize 2000 maxblocks 3960.0 558807.1 1411.1
File Copy 256 bufsize 500 maxblocks 1655.0 147747.3 892.7
File Copy 4096 bufsize 8000 maxblocks 5800.0 1626154.1 2803.7
Pipe Throughput 12440.0 694372.9 558.2
Pipe-based Context Switching 4000.0 38287.1 95.7
Process Creation 126.0 3996.4 317.2
Shell Scripts (1 concurrent) 42.4 5329.5 1257.0
Shell Scripts (8 concurrent) 6.0 1652.7 2754.6
System Call Overhead 15000.0 376172.8 250.8
========
System Benchmarks Index Score 794.5
------------------------------------------------------------------------
Benchmark Run: Sat Sep 30 2023 21:12:03 - 21:40:12
4 CPUs in system; running 4 parallel copies of tests
Dhrystone 2 using register variables 195460759.7 lps (10.0 s, 7 samples)
Double-Precision Whetstone 30016.5 MWIPS (9.9 s, 7 samples)
Execl Throughput 3323.8 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 2086819.5 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 382716.3 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 2983229.5 KBps (30.0 s, 2 samples)
Pipe Throughput 2296574.2 lps (10.0 s, 7 samples)
Pipe-based Context Switching 219379.2 lps (10.0 s, 7 samples)
Process Creation 14186.6 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 11666.8 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 1744.4 lpm (60.1 s, 2 samples)
System Call Overhead 1136930.0 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 195460759.7 16749.0
Double-Precision Whetstone 55.0 30016.5 5457.5
Execl Throughput 43.0 3323.8 773.0
File Copy 1024 bufsize 2000 maxblocks 3960.0 2086819.5 5269.7
File Copy 256 bufsize 500 maxblocks 1655.0 382716.3 2312.5
File Copy 4096 bufsize 8000 maxblocks 5800.0 2983229.5 5143.5
Pipe Throughput 12440.0 2296574.2 1846.1
Pipe-based Context Switching 4000.0 219379.2 548.4
Process Creation 126.0 14186.6 1125.9
Shell Scripts (1 concurrent) 42.4 11666.8 2751.6
Shell Scripts (8 concurrent) 6.0 1744.4 2907.3
System Call Overhead 15000.0 1136930.0 758.0
========
System Benchmarks Index Score
二、CoreMark
官网网址:https://www.eembc.org/coremark/
Git源码:https://github.com/eembc/coremark/
什么是CoreMark?
CoreMark是一个简单而复杂的基准测试,专门用于测试处理器核心的功能。运行CoreMark产生一个单数字分数,允许用户快速比较处理器,常用来衡量嵌入式系统中微控制器性能。
像Dhrystone一样,CoreMark小巧、便携、易于理解、免费,并显示单个数字基准分数。与Dhrystone不同,CoreMark有特定的运行和报告规则,旨在避免Dhrystone的问题方面。例如,Dhrystone的主要部分实际上暴露了编译器优化工作负载的能力,而不是MCU或CPU的能力。因此,Dhrystone作为编译器基准比作为硬件基准更能说明问题。同样,库调用在Dhrystone的定时部分内进行。通常,这些库调用消耗了基准测试所消耗的大部分时间。由于库代码不是基准测试的一部分,因此很难比较使用不同库的结果。最后,存在关于如何运行Dhrystone的指导方针,但由于结果没有经过认证或验证,因此没有强制执行。关于如何报告Dhrystone结果没有标准化,使用了各种格式(DMIPS, Dhrystones per second, DMIPS/MHz)。
参考链接:
https://www.eembc.org/techlit/datasheets/dhrystone_wp.pdf
三、Dhrystone
Dhrystone是在1984年当时的西门子公司为了衡量计算机的性能系统(而不是嵌入式处理器)提出来的一个专注于整数性能的基准测试程序,其主要目的是测试处理器的整数运算和逻辑运算的性能,经典性能测试标准集(Livermore、Whetstone、Linpack、Dhrystone)之一。
Dhrystone程序的最新版本是2.1,其实际上于1988年便已停更。Dhrystone并没有官网,所以想下载其源程序需要在网络查找,有各种语言版本的实现,以及各种平台下的移植程序。Dhrystone标准的测试方法比较简单:单位时间内跑了多少次Dhrystone程序,其指标单位为常为DMIPS/MHz。
注意,每秒一百万条指令和Dhrystone MIP不一样,历史上VAX VMS 11/1750实际上运行在1757次Dhrystone,并被定义为了1 DMIPS,所以Dhrystone测试结果(单位时间运行的Dhrystone次数)需要除以1757才能得到正确的DMIPS值。
参考链接:
https://www.eembc.org/techlit/datasheets/dhrystone_wp.pdf