在之前的文章中,有介绍过使用 UnixBench 给 Linux 服务器进行性能的基准测试,但是使用那篇文章中的 UnixBench 脚本安装的 UnixBench 工具并不支持 ARM 平台。
最近着手购入不同的开发板进行测试和开发,由于目前在售的大多数 Linux 开发板都是基于 ARM 架构的平台,因此特地找了一个可以在 ARM 架构平台下运行的 UnixBench 工具。本文下面将介绍如何安装 UnixBench,及简单介绍两个开发板的性能对比。
首先我们需要下载 byte-unixbench 源码。
git clone https://github.com/kdlucas/byte-unixbench.git
这个源码是需要我们自行进行编译的,我们在开始编译之前,需要先安装好依赖。
sudo apt install -y make gcc
安装好依赖之后,开始编译。
cd byte-unixbench/UnixBench
make
# 等待编译完成
# 编译完成后,需要给 执行程序赋予执行权限
sudo chmod u+x ./Run
# Ps:除了 Run 程序测试多核的时候,需要执行其他脚本
# 为了避免报错,最好把 UnixBench 目录下脚本都赋予执行权限
sudo chmod u+x -R ./*
完成后,即可开始测试。
sudo ./Run
# 等待测试结果即可
我使用了树莓派3B(4Core 1.2G BCM2837) 和 OrangePi Zero2(4Core 1.4G H616) 进行测试,以下为测试结果,可供参考。
树莓派3B | OrangePi Zero2 | i5 4570 (参考) | |
---|---|---|---|
单核 | 161.4 | 325.2 | 1435.0 |
多核 | 305.2 | 813.4 | — |
从结果上来看,OrangePi Zero2 无论单核还是多核性能都有 树莓派3B 的两倍之多,综合价格和体积,OrangePi 还是有挺高性价比的。
不过,在测试中,发现了一个问题。OrangePi 和 树莓派 的核心都贴了散热片并且装了外壳。然而在测试多核的测试中,OrangePi CPU 温度高达110多度(室内温度20度),并且自动断电关机,无法完成测试。需要把外壳拆了,裸露开发板,测试才能顺利完成,且最高 CPU 温度为 85度。而树莓派则没有出现异常。
OrangePi Zero2
BYTE UNIX Benchmarks (Version 5.1.3)
System: orangepizero2: GNU/Linux
OS: GNU/Linux -- 4.9.170-sun50iw9 -- #5 SMP PREEMPT Thu Dec 9 11:16:31 CST 2021
Machine: aarch64 (aarch64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
09:26:40 up 1 min, 2 users, load average: 1.34, 0.48, 0.17; runlevel 2021-12-30
------------------------------------------------------------------------
Benchmark Run: Thu Dec 30 2021 09:26:40 - 09:54:39
4 CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 7685488.5 lps (10.0 s, 7 samples)
Double-Precision Whetstone 1935.6 MWIPS (10.0 s, 7 samples)
Execl Throughput 758.3 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 139166.7 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 40638.5 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 377355.5 KBps (30.0 s, 2 samples)
Pipe Throughput 265008.9 lps (10.0 s, 7 samples)
Pipe-based Context Switching 47317.9 lps (10.0 s, 7 samples)
Process Creation 2134.9 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 2208.8 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 577.1 lpm (60.1 s, 2 samples)
System Call Overhead 427785.6 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 7685488.5 658.6
Double-Precision Whetstone 55.0 1935.6 351.9
Execl Throughput 43.0 758.3 176.3
File Copy 1024 bufsize 2000 maxblocks 3960.0 139166.7 351.4
File Copy 256 bufsize 500 maxblocks 1655.0 40638.5 245.5
File Copy 4096 bufsize 8000 maxblocks 5800.0 377355.5 650.6
Pipe Throughput 12440.0 265008.9 213.0
Pipe-based Context Switching 4000.0 47317.9 118.3
Process Creation 126.0 2134.9 169.4
Shell Scripts (1 concurrent) 42.4 2208.8 520.9
Shell Scripts (8 concurrent) 6.0 577.1 961.8
System Call Overhead 15000.0 427785.6 285.2
========
System Benchmarks Index Score 325.2
------------------------------------------------------------------------
Benchmark Run: Thu Dec 30 2021 09:54:39 - 10:22:41
4 CPUs in system; running 4 parallel copies of tests
Dhrystone 2 using register variables 30609028.3 lps (10.0 s, 7 samples)
Double-Precision Whetstone 7734.7 MWIPS (10.0 s, 7 samples)
Execl Throughput 2254.5 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 236175.7 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 62552.9 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 706088.3 KBps (30.0 s, 2 samples)
Pipe Throughput 1052209.3 lps (10.0 s, 7 samples)
Pipe-based Context Switching 169853.0 lps (10.0 s, 7 samples)
Process Creation 4613.5 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 4495.4 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 607.8 lpm (60.3 s, 2 samples)
System Call Overhead 1678307.4 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 30609028.3 2622.9
Double-Precision Whetstone 55.0 7734.7 1406.3
Execl Throughput 43.0 2254.5 524.3
File Copy 1024 bufsize 2000 maxblocks 3960.0 236175.7 596.4
File Copy 256 bufsize 500 maxblocks 1655.0 62552.9 378.0
File Copy 4096 bufsize 8000 maxblocks 5800.0 706088.3 1217.4
Pipe Throughput 12440.0 1052209.3 845.8
Pipe-based Context Switching 4000.0 169853.0 424.6
Process Creation 126.0 4613.5 366.2
Shell Scripts (1 concurrent) 42.4 4495.4 1060.2
Shell Scripts (8 concurrent) 6.0 607.8 1013.0
System Call Overhead 15000.0 1678307.4 1118.9
========
System Benchmarks Index Score 813.4
树莓派3B
BYTE UNIX Benchmarks (Version 5.1.3)
System: rpi3: GNU/Linux
OS: GNU/Linux -- 5.4.0-1047-raspi -- #52-Ubuntu SMP PREEMPT Wed Nov 24 08:16:38 UTC 2021
Machine: aarch64 (aarch64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
16:21:57 up 4 min, 2 users, load average: 0.49, 0.49, 0.25; runlevel 2021-12-30
------------------------------------------------------------------------
Benchmark Run: Thu Dec 30 2021 16:21:57 - 16:50:00
4 CPUs in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 6069132.0 lps (10.0 s, 7 samples)
Double-Precision Whetstone 1525.8 MWIPS (10.0 s, 7 samples)
Execl Throughput 392.9 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 58002.0 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 15651.9 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 172918.0 KBps (30.0 s, 2 samples)
Pipe Throughput 87445.0 lps (10.0 s, 7 samples)
Pipe-based Context Switching 18762.2 lps (10.0 s, 7 samples)
Process Creation 1707.4 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 1325.6 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 272.3 lpm (60.1 s, 2 samples)
System Call Overhead 135883.8 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 6069132.0 520.1
Double-Precision Whetstone 55.0 1525.8 277.4
Execl Throughput 43.0 392.9 91.4
File Copy 1024 bufsize 2000 maxblocks 3960.0 58002.0 146.5
File Copy 256 bufsize 500 maxblocks 1655.0 15651.9 94.6
File Copy 4096 bufsize 8000 maxblocks 5800.0 172918.0 298.1
Pipe Throughput 12440.0 87445.0 70.3
Pipe-based Context Switching 4000.0 18762.2 46.9
Process Creation 126.0 1707.4 135.5
Shell Scripts (1 concurrent) 42.4 1325.6 312.7
Shell Scripts (8 concurrent) 6.0 272.3 453.9
System Call Overhead 15000.0 135883.8 90.6
========
System Benchmarks Index Score 161.4
------------------------------------------------------------------------
Benchmark Run: Thu Dec 30 2021 16:50:00 - 17:18:11
4 CPUs in system; running 4 parallel copies of tests
Dhrystone 2 using register variables 12427417.2 lps (10.0 s, 7 samples)
Double-Precision Whetstone 6111.5 MWIPS (10.0 s, 7 samples)
Execl Throughput 769.4 lps (29.6 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 72974.3 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 20862.5 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 176187.0 KBps (30.0 s, 2 samples)
Pipe Throughput 232372.2 lps (10.0 s, 7 samples)
Pipe-based Context Switching 51766.8 lps (10.0 s, 7 samples)
Process Creation 4270.3 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 2032.2 lpm (60.1 s, 2 samples)
Shell Scripts (8 concurrent) 265.8 lpm (60.3 s, 2 samples)
System Call Overhead 377412.9 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 12427417.2 1064.9
Double-Precision Whetstone 55.0 6111.5 1111.2
Execl Throughput 43.0 769.4 178.9
File Copy 1024 bufsize 2000 maxblocks 3960.0 72974.3 184.3
File Copy 256 bufsize 500 maxblocks 1655.0 20862.5 126.1
File Copy 4096 bufsize 8000 maxblocks 5800.0 176187.0 303.8
Pipe Throughput 12440.0 232372.2 186.8
Pipe-based Context Switching 4000.0 51766.8 129.4
Process Creation 126.0 4270.3 338.9
Shell Scripts (1 concurrent) 42.4 2032.2 479.3
Shell Scripts (8 concurrent) 6.0 265.8 442.9
System Call Overhead 15000.0 377412.9 251.6
========
System Benchmarks Index Score 305.2
i5 4570 (单核参考)
BYTE UNIX Benchmarks (Version 5.1.3)
System: ubuntu: GNU/Linux
OS: GNU/Linux -- 4.4.0-119-generic -- #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (6411.1 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
10:45:37 up 2 min, 1 user, load average: 0.22, 0.07, 0.02; runlevel 5
------------------------------------------------------------------------
Benchmark Run: Wed Apr 18 2018 10:45:37 - 11:13:49
1 CPU in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 40453839.7 lps (10.0 s, 7 samples)
Double-Precision Whetstone 2933.5 MWIPS (9.9 s, 7 samples)
Execl Throughput 5999.9 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 818195.6 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 246488.8 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 1618077.0 KBps (30.0 s, 2 samples)
Pipe Throughput 1298128.5 lps (10.0 s, 7 samples)
Pipe-based Context Switching 218737.5 lps (10.0 s, 7 samples)
Process Creation 15710.1 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 10794.3 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 1405.5 lpm (60.0 s, 2 samples)
System Call Overhead 1217286.8 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 40453839.7 3466.5
Double-Precision Whetstone 55.0 2933.5 533.4
Execl Throughput 43.0 5999.9 1395.3
File Copy 1024 bufsize 2000 maxblocks 3960.0 818195.6 2066.2
File Copy 256 bufsize 500 maxblocks 1655.0 246488.8 1489.4
File Copy 4096 bufsize 8000 maxblocks 5800.0 1618077.0 2789.8
Pipe Throughput 12440.0 1298128.5 1043.5
Pipe-based Context Switching 4000.0 218737.5 546.8
Process Creation 126.0 15710.1 1246.8
Shell Scripts (1 concurrent) 42.4 10794.3 2545.8
Shell Scripts (8 concurrent) 6.0 1405.5 2342.5
System Call Overhead 15000.0 1217286.8 811.5
========
System Benchmarks Index Score 1435.0