本帖最后由 赵美京₁₉⁸⁸⁸ 于 2024-3-27 11:27 编辑
【树莓派5 测评】 + 03.CPU、DDR与蓝牙测试(zmj)
1. CPU性能测试 .
1.1 查看CPU信息树莓派5采用了四核 2.4 GHz Cortex-A76 Arm CPU,支持32-bit/64-bit两种模式指令集。运行时CPU的低功耗模式CPU工作频率1.5GHz,高性能模式CPU工作频率2.4GHz。 通过查看CPU信息的反馈结果可以确认上述信息。 - //------查看CPU信息:lscpu
- //---指令
- lscpu
- cat /proc/cpuinfo
- //---结果
- 指令集: Cortex-A76 Arm
- 4核CPU:编号0~3
- //------查看CPU频率:
- //---指令
- cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq
- cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_max_freq
- cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_min_freq
- //---结果
- 工作频率:1.5GHz~2.4GHz
- 当前频率:1.5GHz
- //---借助vcgencmd查看CPU频率
- vcgencmd measure_clock arm
- //------示例Log信息
- zhaomeijing@raspberrypi5:~$ lscpu
- Architecture: aarch64
- CPU op-mode(s): 32-bit, 64-bit
- Byte Order: Little Endian
- CPU(s): 4
- On-line CPU(s) list: 0-3
- Vendor ID: ARM
- Model name: Cortex-A76
- Model: 1
- Thread(s) per core: 1
- Core(s) per cluster: 4
- Socket(s): -
- Cluster(s): 1
- Stepping: r4p1
- CPU(s) scaling MHz: 62%
- CPU max MHz: 2400.0000
- CPU min MHz: 1500.0000
- BogoMIPS: 108.00
- Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- Vulnerabilities:
- Gather data sampling: Not affected
- Itlb multihit: Not affected
- L1tf: Not affected
- Mds: Not affected
- Meltdown: Not affected
- Mmio stale data: Not affected
- Retbleed: Not affected
- Spec rstack overflow: Not affected
- Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
- Spectre v1: Mitigation; __user pointer sanitization
- Spectre v2: Mitigation; CSV2, BHB
- Srbds: Not affected
- Tsx async abort: Not affected
- zhaomeijing@raspberrypi5:~$ cat /proc/cpuinfo
- processor : 0
- BogoMIPS : 108.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x4
- CPU part : 0xd0b
- CPU revision : 1
- processor : 1
- BogoMIPS : 108.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x4
- CPU part : 0xd0b
- CPU revision : 1
- processor : 2
- BogoMIPS : 108.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x4
- CPU part : 0xd0b
- CPU revision : 1
- processor : 3
- BogoMIPS : 108.00
- Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
- CPU implementer : 0x41
- CPU architecture: 8
- CPU variant : 0x4
- CPU part : 0xd0b
- CPU revision : 1
- Revision : c04170
- Serial : c4197593e8cb6150
- Model : Raspberry Pi 5 Model B Rev 1.0
- zhaomeijing@raspberrypi5:~$ sudo cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq
- 1500000
- zhaomeijing@raspberrypi5:~$ cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_max_freq
- 2400000
- zhaomeijing@raspberrypi5:~$ cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_min_freq
- 1500000
- zhaomeijing@raspberrypi5:~$ vcgencmd measure_clock arm
- frequency(0)=1500016128
- zhaomeijing@raspberrypi5:~$
复制代码 1.2 CoreMark性能测试
1.2.1 CoreMark简介//------CoreMark简介 CoreMark是用来衡量嵌入式系统中心处理单元(CPU,或叫做微控制器MCU)性能的标准。 该标准于2009年由EEMBC组织的Shay Gla-On提出,并且试图将其发展成为工业标准,从而代替陈旧的Dhrystone标准。代码使用C语言写成,包含如下的运算法则:列举(寻找并排序),数学矩阵操作(普通矩阵运算)和状态机(用来确定输入流中是否包含有效数字),最后还包括CRC(循环冗余校验)。 CoreMark是由EEMBC(Embedded Microprocessor Benchmark Consortium)的Shay Gla-On于2009年提出的一项基准测试程序,CoreMark的主要目标是简化操作,并提供一套测试单核处理器核心的方法。测试标准是在配置参数的组合下单位时间内运行的CoreMark程序次数(单位:CoreMark/MHz),该数字值越大则说明测试的性能越好。 目前在嵌入式CPU行业中普遍公认的性能测试指标的标准主要使用以下三种,MIPS、Dhrystone、Coremark,而CoreMark与Dhrystone一样,拥有体积小、方便移植、易于理解、免费并且显示单个数字基准分数。与Dhrystone不同的是,Dhrystone的主要部分实际上暴露了编译器优化工作负载的能力,而不是实际MCU或CPU的能力,的性能,而CoreMark具有特定的运行和报告规则,从而可以避免由于所使用的编译库不同而导致的测试结果难以比较。 1.2.2 CoreMark源码获取与编译//------CoreMark源码获取 EEMBC 在将 CoreMark 源码托管在 GitHub 上可以访**ithub.com/eembc/coremark直接点击下载获得源码;也可以通过 git 命令下载到本地。 - //------CoreMark源码获取
- //---CoreMark说明
- https://www.eembc.org/coremark/
- //---直接下载(CoreMark开源代码仓)
- https://github.com/eembc/coremark
- //---Git下载
- git clone https://github.com/eembc/coremark.git
- //---编译(生成可执行程序coremark.exe)
- make run
- 或者
- make
复制代码CoreMark 项目的详细介绍,可以查阅当前目录下 “coremark/docs/html/index.html” 。以下是当前目录的每个文件介绍: - #在tree命令的输出中,作了部分删除(不影响分析整个CoreMark工程)
- imaginemiracle@:coremark$ tree
- .
- ├── barebones --移植到裸机环境下需要修改的目录
- │ ├── core_portme.c --移植的目标平台配置信息
- │ ├── core_portme.h --计时以及板级初始化实现
- │ ├── core_portme.mak --该子目录的makefile
- │ ├── cvt.c
- │ └── ee_printf.c --打印函数串口发送实现
- ├── core_list_join.c --列表操作程序
- ├── core_main.c --主程序
- ├── coremark.h --项目配置与数据结构的定义头文件
- ├── coremark.md5
- ├── core_matrix.c --矩阵运算程序
- ├── core_state.c --状态机控制程序
- ├── core_util.c --CRC计算程序
- ├── cygwin --x86 cygwin和gcc 3.4(四核,双核和单核系统)的测试代码
- │ ├── core_portme.c
- │ ├── core_portme.h
- │ └── core_portme.mak
- ├── freebsd --以下同理,是在不同操作系统下的测试代码
- │ ├── ...
- ├── LICENSE.md
- ├── linux
- │ ├── ...
- ├── linux64
- │ ├── ...
- ├── macos
- │ ├── ...
- ├── Makefile
- ├── README.md --自述文件,CoreMark项目的基本介绍
- ├── rtems
- │ ├── ...
- └──simple
- ├── ...
- └── core_portme.mak
复制代码 1.2.3 运行coremark.exe测试性能 运行coremark.exe测试性能,测试得分18078.823671。 - zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr $ git clone https://github.com/eembc/coremark.git
- Cloning into 'coremark'...
- remote: Enumerating objects: 379, done.
- remote: Counting objects: 100% (163/163), done.
- remote: Compressing objects: 100% (61/61), done.
- remote: Total 379 (delta 121), reused 115 (delta 97), pack-reused 216
- Receiving objects: 100% (379/379), 517.77 KiB | 1.06 MiB/s, done.
- Resolving deltas: 100% (217/217), done.
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr $ ll
- total 12
- drwxr-xr-x 3 zhaomeijing zhaomeijing 4096 Mar 24 19:49 ./
- drwxr-xr-x 3 zhaomeijing zhaomeijing 4096 Mar 24 19:49 ../
- drwxr-xr-x 14 zhaomeijing zhaomeijing 4096 Mar 24 19:49 coremark/
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr $ cd coremark/
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr/coremark $ make
- (省略编译过程,详细可以参考README.md)
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr/coremark $ ./coremark.exe
- 2K performance run parameters for coremark.
- CoreMark Size : 666
- Total ticks : 16594
- Total time (secs): 16.594000
- Iterations/Sec : 18078.823671
- Iterations : 300000
- Compiler version : GCC12.2.0
- Compiler flags : -O2 -DPERFORMANCE_RUN=1 -lrt
- Memory location : Please put data memory location here
- (e.g. code in flash, data on heap etc)
- seedcrc : 0xe9f5
- [0]crclist : 0xe714
- [0]crcmatrix : 0x1fd7
- [0]crcstate : 0x8e3a
- [0]crcfinal : 0xcc42
- Correct operation validated. See README.md for run and reporting rules.
- CoreMark 1.0 : 18078.823671 / GCC12.2.0 -O2 -DPERFORMANCE_RUN=1 -lrt / Heap
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr/coremark $
复制代码
1.3 CPU温度检测此处示例两种获取CPU温度的方式:lm-sensors和lm-sensors是一款linux的硬件监控的软件,可以帮助我们来监控主板,CPU的工作电压,风扇转速、温度等数据。当然,树莓派5还可以通过vcgencmd指令查看温度等信息。 - //------sensors
- //---sensors安装
- sudo apt install lm-sensors
- //---snesors使用
- sensors
- //------vcgencmd
- //---vcgencmd指令
- vcgencmd commands
- //---vcgencmd获取温度
- vcgencmd measure_temp
- //------示例Log信息
- zhaomeijing@raspberrypi5:~$ sudo apt install lm-sensors
- zhaomeijing@raspberrypi5:~$ sensors
- rpi_volt-isa-0000
- Adapter: ISA adapter
- in0: N/A
- cpu_thermal-virtual-0
- Adapter: Virtual device
- temp1: +37.5°C
- rp1_adc-isa-0000
- Adapter: ISA adapter
- in1: 955.00 mV
- in2: 2.52 V
- in3: 1.40 V
- in4: 1.42 V
- temp1: +42.1°C
- zhaomeijing@raspberrypi5:~$ vcgencmd commands
- commands="commands, set_logging, bootloader_config, bootloader_version, cache_flush, codec_enable pmicrd, pmicwr, read_ring_osc, version, readmr, otp_dump, pmic_read_adc, power_monitor"
- zhaomeijing@raspberrypi5:~$ vcgencmd measure_temp
- temp=37.8'C
- zhaomeijing@raspberrypi5:~$
复制代码 2. DDR内存性能测试 树莓派5开发板采用4GB LPDDR4-SDRAM。 2.1 DDR内存基本信息通过“free -h”指令读取内存DDR的使用情况;通过/proc/meminfo 文件读取系统中的内存的参数信息。 - //------测试工具
- free
- //---测试指令
- free -h
- 或者
- free -m
- //---参数解析
- -h 参数代表单位为 GByte
- -m 参数代表单位为 MByte
- total :内存总量
- used :被使用的内存量
- free :可使用的内存量
- //------查看系统内存信息文件
- cat /proc/meminfo
- //------
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ free -h
- total used free shared buff/cache available
- Mem: 4.0Gi 874Mi 477Mi 82Mi 2.8Gi 3.1Gi
- Swap: 99Mi 0B 99Mi
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ free -m
- total used free shared buff/cache available
- Mem: 4045 874 477 82 2840 3170
- Swap: 99 0 99
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ cat /proc/meminfo
- MemTotal: 4142304 kB
- MemFree: 488816 kB
- MemAvailable: 3246416 kB
- Buffers: 293648 kB
- Cached: 2447392 kB
- SwapCached: 0 kB
- Active: 1915696 kB
- Inactive: 1390080 kB
- Active(anon): 649056 kB
- Inactive(anon): 0 kB
- Active(file): 1266640 kB
- Inactive(file): 1390080 kB
- Unevictable: 41568 kB
- Mlocked: 32 kB
- SwapTotal: 102384 kB
- SwapFree: 102384 kB
- Zswap: 0 kB
- Zswapped: 0 kB
- Dirty: 0 kB
- Writeback: 0 kB
- AnonPages: 606528 kB
- Mapped: 259216 kB
- Shmem: 84320 kB
- KReclaimable: 167568 kB
- Slab: 213360 kB
- SReclaimable: 167568 kB
- SUnreclaim: 45792 kB
- KernelStack: 6672 kB
- PageTables: 18288 kB
- SecPageTables: 0 kB
- NFS_Unstable: 0 kB
- Bounce: 0 kB
- WritebackTmp: 0 kB
- CommitLimit: 2173536 kB
- Committed_AS: 3168656 kB
- VmallocTotal: 68180246528 kB
- VmallocUsed: 22672 kB
- VmallocChunk: 0 kB
- Percpu: 1280 kB
- CmaTotal: 327680 kB
- CmaFree: 195872 kB
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$
复制代码 2.2 内存功能压力测试-memtester内存功能压力测试-memtester需要安装: - //------安装内存功能压力测试工具memtester
- sudo apt install memtester -y
- 或者
- sudo apt-get install memtester -y
复制代码memtester通过给定测试内存的大小和次数, 可以对系统现有的内存进行压力上的测试。例如指定内存大小 512MB,测试次数为 10,则测试命令为“memtester 512M 10"。 下列以使用 512MB 内存空间,单次测试为例: - //------测试工具(MYD-YG2LX系统已带)
- memtester
- //------测试指令
- memtester 512M 1
- //---指令说明
- 指定内存大小 512MB,测试次数为 1
- //---示例
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ memtester 512M 1
- memtester version 4.6.0 (64-bit)
- Copyright (C) 2001-2020 Charles Cazabon.
- Licensed under the GNU General Public License version 2 (only).
- pagesize is 16384
- pagesizemask is 0xffffffffffffc000
- want 512MB (536870912 bytes)
- got 512MB (536870912 bytes), trying mlock ...locked.
- Loop 1/1:
- Stuck Address : ok
- Random Value : ok
- Compare XOR : ok
- Compare SUB : ok
- Compare MUL : ok
- Compare DIV : ok
- Compare OR : ok
- Compare AND : ok
- Sequential Increment: ok
- Solid Bits : ok
- Block Sequential : ok
- Checkerboard : ok
- Bit Spread : ok
- Bit Flip : ok
- Walking Ones : ok
- Walking Zeroes : ok
- 8-bit Writes : ok
- 16-bit Writes : ok
- Done.
- zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$
复制代码 3. 蓝牙功能测试(蓝牙键盘)树莓派5自带蓝牙5.0 /低功耗蓝牙(BLE),手上有一块蓝牙键盘正好用来测试(Device 15:03:02:62:10:C4 BT 5.1 keyboard-1503)。 测试流程和详细日志参考下方: - //------蓝牙软件安装(准备工作,官方系统该镜像已经安装,此处仅作安装说明)
- a.先升级软件安装包:
- sudo apt-get update
- b.下载蓝牙管理工具:
- sudo apt-get install bluetooth bluez blueman
- //------蓝牙连接使用(测试蓝牙键盘连接)
- a.首先使待链接树莓派的蓝牙键盘处于被发现状态;
- b.然后扫描蓝牙设备,记录设备蓝牙地址
- sudo bluetoothctl scan on
- 借助grep指令查找具体某个设备
- sudo bluetoothctl scan on | grep "1503"
- c.蓝牙配对设备(需要使用设备地址)
- sudo bluetoothctl pair Device-Address
- sudo bluetoothctl pair 15:03:02:62:10:C4
- d.查看蓝牙
- bluetoothctl
- //------示例Log日志
- zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl scan on
- zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl list
- Controller D8:3A:DD:BF:C2:C7 raspberrypi5 [default]
- zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl scan on | grep "1503"
- [NEW] Device 15:03:02:62:10:C4 BT 5.1 keyboard-1503
- zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl pair 15:03:02:62:10:C4
- Attempting to pair with 15:03:02:62:10:C4
- [CHG] Device 15:03:02:62:10:C4 Connected: yes
- [CHG] Device 15:03:02:62:10:C4 Bonded: yes
- [CHG] Device 15:03:02:62:10:C4 Modalias: usb:v0A5Cp8503d011B
- [CHG] Device 15:03:02:62:10:C4 UUIDs: 00001000-0000-1000-8000-00805f9b34fb
- [CHG] Device 15:03:02:62:10:C4 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
- [CHG] Device 15:03:02:62:10:C4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
- [CHG] Device 15:03:02:62:10:C4 ServicesResolved: yes
- [CHG] Device 15:03:02:62:10:C4 Paired: yes
- Pairing successful
- zhaomeijing@raspberrypi5:~/workspace $ bluetoothctl
- Agent registered
- [bluetooth]# show
- Controller D8:3A:DD:BF:C2:C7 (public)
- Name: raspberrypi5
- Alias: raspberrypi5
- Class: 0x006c0000
- Powered: yes
- Discoverable: no
- DiscoverableTimeout: 0x000000b4
- Pairable: yes
- UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
- UUID: Handsfree Audio Gateway (0000111f-0000-1000-8000-00805f9b34fb)
- UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
- UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
- UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)
- UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
- UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
- UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
- UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
- UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
- Modalias: usb:v1D6Bp0246d0542
- Discovering: no
- Roles: central
- Roles: peripheral
- Advertising Features:
- ActiveInstances: 0x00 (0)
- SupportedInstances: 0x05 (5)
- SupportedIncludes: tx-power
- SupportedIncludes: appearance
- SupportedIncludes: local-name
- [bluetooth]# devices
- Device 15:03:02:62:10:C4 BT 5.1 keyboard-1503
- [bluetooth]# exit
- zhaomeijing@raspberrypi5:~/workspace $
复制代码
//------end
|