嵌入式开发中对要设计的产品、立项的项目进行设计时,往往需要对关键芯片进行性能评估,本文主要总结基于linux系统的产品在性能评估时的工具使用总结,在aarch64(arm64平台下测试),板卡根文件系统为debian系统。
工具列表如下:
名称 | 作用 | git源码链接 |
---|---|---|
lmbench | 带宽测评,反应时间测评 | https://github.com/redrose2100/lmbench.git |
stream | 内存带宽(每秒通过的字节数)测试 | https://github.com/jeffhammond/STREAM.git |
unixbench | 测试 unix 系统基本性能,测试的结果不仅仅只是CPU,内存,或者磁盘为基准,还取决于硬件,操作系统版本,编译器. | https://github.com/kdlucas/byte-unixbench.git |
cyclictest 和 stress-ng | 实时性测试 | 压力工具 git clone https://github.com/ColinIanKing/stress-ng.git ,测试工具git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git |
1、编译
export CC=aarch64-linux-gnu-gcc
make clean
make
提示报错:
/opt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/7.5.0/../../../../aarch64-linux-gnu/bin/ld: 找不到 -ltirpc
collect2: error: ld returned 1 exit status
Makefile:295: recipe for target '../bin/x86_64-pc-linux-gnu/bw_file_rd' failed
make[2]: *** [../bin/x86_64-pc-linux-gnu/bw_file_rd] Error 1
将script/build中的 LDLIBS=“-lm -ltirpc” 改成 LDLIBS=“-lm”
make 编译通过
2、将文件夹压缩后,拷贝到嵌入式板卡中解压
3、cp -r lmbench/bin/aarch64-linux-gnu lmbench/bin/aarch64-unknown-linux ,此句在板卡中操作
4、测试,以下命令在板卡中执行
cd scripts
./config-run
根据提示 第一个提示输入1 回车 ,第二个提示输入1 回车, 第三个提示输入 128 回车
随后一直回车
直到看到 是否发邮件 输入 no 回车, 等待产生文件配置文件
./results
等待测试结果
cd ../results
make summary percent 2>/dev/null | more > lmbench-result.txt
将lmbench-result.txt从板卡中导出
5、结果含义分析,示例结果如下
L M B E N C H 3 . 0 S U M M A R Y
------------------------------------
(Alpha software, do not distribute)
Processor, Processes - times in microseconds - smaller is better
------------------------------------------------------------------------------
Host OS Mhz null null open slct sig sig fork exec sh
call I/O stat clos TCP inst hndl proc proc proc
--------- ------------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
driver Linux 5.10.16 1797 0.31 0.37 0.97 2.51 5.25 0.50 2.42 174. 566. 1395
Basic integer operations - times in nanoseconds - smaller is better
-------------------------------------------------------------------
Host OS intgr intgr intgr intgr intgr
bit add mul div mod
--------- ------------- ------ ------ ------ ------ ------
driver Linux 5.10.16 0.3700 0.1400 0.0400 4.4600 5.4300
Basic float operations - times in nanoseconds - smaller is better
-----------------------------------------------------------------
Host OS float float float float
add mul div bogo
--------- ------------- ------ ------ ------ ------
driver Linux 5.10.16 2.2300 2.2300 6.1300 2.5100
Basic double operations - times in nanoseconds - smaller is better
------------------------------------------------------------------
Host OS double double double double
add mul div bogo
--------- ------------- ------ ------ ------ ------
driver Linux 5.10.16 2.2300 2.2300 10.0 8.9100
Context switching - times in microseconds - smaller is better
-------------------------------------------------------------------------
Host OS 2p/0K 2p/16K 2p/64K 8p/16K 8p/64K 16p/16K 16p/64K
ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw
--------- ------------- ------ ------ ------ ------ ------ ------- -------
driver Linux 5.10.16 1.9100 2.0300 1.9300 3.0500 3.5400 3.32000 10.1
*Local* Communication latencies in microseconds - smaller is better
---------------------------------------------------------------------
Host OS 2p/0K Pipe AF UDP RPC/ TCP RPC/ TCP
ctxsw UNIX UDP TCP conn
--------- ------------- ----- ----- ---- ----- ----- ----- ----- ----
driver Linux 5.10.16 1.910 7.999 11.9 17.0 24.4 67.
File & VM system latencies in microseconds - smaller is better
-------------------------------------------------------------------------------
Host OS 0K File 10K File Mmap Prot Page 100fd
Create Delete Create Delete Latency Fault Fault selct
--------- ------------- ------ ------ ------ ------ ------- ----- ------- -----
driver Linux 5.10.16 15.6 13.0 34.8 19.4 1638.0 0.363 0.36280 2.550
*Local* Communication bandwidths in MB/s - bigger is better
-----------------------------------------------------------------------------
Host OS Pipe AF TCP File Mmap Bcopy Bcopy Mem Mem
UNIX reread reread (libc) (hand) read write
--------- ------------- ---- ---- ---- ------ ------ ------ ------ ---- -----
driver Linux 5.10.16 2214 2956 1695 3266.6 9768.4 5202.6 5127.5 6420 7181.
Memory latencies in nanoseconds - smaller is better
(WARNING - may not be correct, check graphs)
------------------------------------------------------------------------------
Host OS Mhz L1 $ L2 $ Main mem Rand mem Guesses
--------- ------------- --- ---- ---- -------- -------- -------
driver Linux 5.10.16 1797 2.2270 4.9450 12.1 134.1
结果解释:
Processor, Processes - times in microseconds - smaller is better
CPU处理性能各项时间数值越小越好,单位毫秒,包括:
结果名称 | 含义解释 |
---|---|
OS | OS版本 |
Mhz | cpu动态运行的频率 |
null call | 系统调用 |
null I/O | 模拟操作IO设备的时间 |
stat | stat 文件信息的时间 |
open clos | 打开关闭文件的时间 |
slct TCP | 网络连接的建立,管道,TCP,UDP 和RPC hot potato |
sig inst | 信号安装时间 |
sig hndl | 信号处理时间 |
fork proc | fork一个进程的时间 |
exec proc | 执行一个模拟进程的时间 |
sh proc | shell脚本执行时间 |
Basic integer operations - times in nanoseconds - smaller is better
基本整形运算操作时间数值越小越好,单位:纳秒,包括
结果名称 | 解释说明 |
---|---|
OS | OS版本 |
intgr bit | 位操作 |
intgr add | 加法操作 |
intgr mul | 乘法操作 |
intgr div | 除法操作 |
intgr mod | 取模操作 |
Basic float operations - times in nanoseconds - smaller is better
基本单精度浮点运算操作时间数值越小越好,单位:纳秒,包括:
Basic double operations - times in nanoseconds - smaller is better
基本双精度浮点运算操作时间数值越小越好,单位:纳秒,包括:
Context switching - times in microseconds - smaller is better
上下文切换操作时间数值越小越好,单位:毫秒,包括:
Local Communication latencies in microseconds - smaller is better
File & VM system latencies in microseconds - smaller is better
Local Communication bandwidths in MB/s - bigger is better
Memory latencies in nanoseconds - smaller is better