回答

收藏

[评测分享] 【树莓派5 测评】 + 03.CPU、DDR与蓝牙测试(zmj)

#板卡评测 #板卡评测 3348 人阅读 | 0 人回复 | 2024-03-27

本帖最后由 赵美京????? 于 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信息的反馈结果可以确认上述信息。
  1. //------查看CPU信息:lscpu
  2. //---指令
  3. lscpu
  4. cat /proc/cpuinfo
  5. //---结果
  6. 指令集: Cortex-A76 Arm
  7. 4核CPU:编号0~3
  8. //------查看CPU频率:
  9. //---指令
  10. cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq
  11. cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_max_freq
  12. cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_min_freq
  13. //---结果
  14. 工作频率:1.5GHz~2.4GHz
  15. 当前频率:1.5GHz
  16. //---借助vcgencmd查看CPU频率
  17. vcgencmd measure_clock arm
  18. //------示例Log信息
  19. zhaomeijing@raspberrypi5:~$ lscpu
  20. Architecture:            aarch64
  21.   CPU op-mode(s):        32-bit, 64-bit
  22.   Byte Order:            Little Endian
  23. CPU(s):                  4
  24.   On-line CPU(s) list:   0-3
  25. Vendor ID:               ARM
  26.   Model name:            Cortex-A76
  27.     Model:               1
  28.     Thread(s) per core:  1
  29.     Core(s) per cluster: 4
  30.     Socket(s):           -
  31.     Cluster(s):          1
  32.     Stepping:            r4p1
  33.     CPU(s) scaling MHz:  62%
  34.     CPU max MHz:         2400.0000
  35.     CPU min MHz:         1500.0000
  36.     BogoMIPS:            108.00
  37.     Flags:               fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
  38. Vulnerabilities:
  39.   Gather data sampling:  Not affected
  40.   Itlb multihit:         Not affected
  41.   L1tf:                  Not affected
  42.   Mds:                   Not affected
  43.   Meltdown:              Not affected
  44.   Mmio stale data:       Not affected
  45.   Retbleed:              Not affected
  46.   Spec rstack overflow:  Not affected
  47.   Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  48.   Spectre v1:            Mitigation; __user pointer sanitization
  49.   Spectre v2:            Mitigation; CSV2, BHB
  50.   Srbds:                 Not affected
  51.   Tsx async abort:       Not affected
  52. zhaomeijing@raspberrypi5:~$ cat /proc/cpuinfo
  53. processor       : 0
  54. BogoMIPS        : 108.00
  55. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
  56. CPU implementer : 0x41
  57. CPU architecture: 8
  58. CPU variant     : 0x4
  59. CPU part        : 0xd0b
  60. CPU revision    : 1

  61. processor       : 1
  62. BogoMIPS        : 108.00
  63. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
  64. CPU implementer : 0x41
  65. CPU architecture: 8
  66. CPU variant     : 0x4
  67. CPU part        : 0xd0b
  68. CPU revision    : 1

  69. processor       : 2
  70. BogoMIPS        : 108.00
  71. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
  72. CPU implementer : 0x41
  73. CPU architecture: 8
  74. CPU variant     : 0x4
  75. CPU part        : 0xd0b
  76. CPU revision    : 1

  77. processor       : 3
  78. BogoMIPS        : 108.00
  79. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
  80. CPU implementer : 0x41
  81. CPU architecture: 8
  82. CPU variant     : 0x4
  83. CPU part        : 0xd0b
  84. CPU revision    : 1

  85. Revision        : c04170
  86. Serial          : c4197593e8cb6150
  87. Model           : Raspberry Pi 5 Model B Rev 1.0
  88. zhaomeijing@raspberrypi5:~$ sudo cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq
  89. 1500000
  90. zhaomeijing@raspberrypi5:~$ cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_max_freq
  91. 2400000
  92. zhaomeijing@raspberrypi5:~$ cat /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_min_freq
  93. 1500000
  94. zhaomeijing@raspberrypi5:~$ vcgencmd measure_clock arm
  95. frequency(0)=1500016128
  96. 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 命令下载到本地。  
  1. //------CoreMark源码获取
  2. //---CoreMark说明
  3. https://www.eembc.org/coremark/
  4. //---直接下载(CoreMark开源代码仓)
  5. https://github.com/eembc/coremark
  6. //---Git下载
  7. git clone https://github.com/eembc/coremark.git
  8. //---编译(生成可执行程序coremark.exe)
  9. make run
  10. 或者
  11. make
复制代码
CoreMark 项目的详细介绍,可以查阅当前目录下 “coremark/docs/html/index.html” 。以下是当前目录的每个文件介绍:  
  1. #在tree命令的输出中,作了部分删除(不影响分析整个CoreMark工程)
  2. imaginemiracle@:coremark$ tree
  3. .
  4. ├── barebones --移植到裸机环境下需要修改的目录
  5. │   ├── core_portme.c --移植的目标平台配置信息
  6. │   ├── core_portme.h --计时以及板级初始化实现
  7. │   ├── core_portme.mak --该子目录的makefile
  8. │   ├── cvt.c
  9. │   └── ee_printf.c --打印函数串口发送实现
  10. ├── core_list_join.c --列表操作程序
  11. ├── core_main.c --主程序
  12. ├── coremark.h --项目配置与数据结构的定义头文件
  13. ├── coremark.md5
  14. ├── core_matrix.c --矩阵运算程序
  15. ├── core_state.c --状态机控制程序
  16. ├── core_util.c --CRC计算程序
  17. ├── cygwin --x86 cygwin和gcc 3.4(四核,双核和单核系统)的测试代码
  18. │   ├── core_portme.c
  19. │   ├── core_portme.h
  20. │   └── core_portme.mak
  21. ├── freebsd --以下同理,是在不同操作系统下的测试代码
  22. │   ├── ...
  23. ├── LICENSE.md
  24. ├── linux
  25. │   ├── ...
  26. ├── linux64
  27. │   ├── ...
  28. ├── macos
  29. │   ├── ...
  30. ├── Makefile
  31. ├── README.md --自述文件,CoreMark项目的基本介绍
  32. ├── rtems
  33. │   ├── ...
  34. └──simple
  35.    ├── ...
  36.    └── core_portme.mak
复制代码
1.2.3        运行coremark.exe测试性能
运行coremark.exe测试性能,测试得分18078.823671。
  1. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr $ git clone https://github.com/eembc/coremark.git
  2. Cloning into 'coremark'...
  3. remote: Enumerating objects: 379, done.
  4. remote: Counting objects: 100% (163/163), done.
  5. remote: Compressing objects: 100% (61/61), done.
  6. remote: Total 379 (delta 121), reused 115 (delta 97), pack-reused 216
  7. Receiving objects: 100% (379/379), 517.77 KiB | 1.06 MiB/s, done.
  8. Resolving deltas: 100% (217/217), done.
  9. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr $ ll
  10. total 12
  11. drwxr-xr-x  3 zhaomeijing zhaomeijing 4096 Mar 24 19:49 ./
  12. drwxr-xr-x  3 zhaomeijing zhaomeijing 4096 Mar 24 19:49 ../
  13. drwxr-xr-x 14 zhaomeijing zhaomeijing 4096 Mar 24 19:49 coremark/
  14. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr $ cd coremark/
  15. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr/coremark $ make
  16. (省略编译过程,详细可以参考README.md)
  17. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr/coremark $ ./coremark.exe
  18. 2K performance run parameters for coremark.
  19. CoreMark Size    : 666
  20. Total ticks      : 16594
  21. Total time (secs): 16.594000
  22. Iterations/Sec   : 18078.823671
  23. Iterations       : 300000
  24. Compiler version : GCC12.2.0
  25. Compiler flags   : -O2 -DPERFORMANCE_RUN=1  -lrt
  26. Memory location  : Please put data memory location here
  27.                         (e.g. code in flash, data on heap etc)
  28. seedcrc          : 0xe9f5
  29. [0]crclist       : 0xe714
  30. [0]crcmatrix     : 0x1fd7
  31. [0]crcstate      : 0x8e3a
  32. [0]crcfinal      : 0xcc42
  33. Correct operation validated. See README.md for run and reporting rules.
  34. CoreMark 1.0 : 18078.823671 / GCC12.2.0 -O2 -DPERFORMANCE_RUN=1  -lrt / Heap
  35. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr/coremark $
复制代码

1.3        CPU温度检测
此处示例两种获取CPU温度的方式:lm-sensors和lm-sensors是一款linux的硬件监控的软件,可以帮助我们来监控主板,CPU的工作电压,风扇转速、温度等数据。当然,树莓派5还可以通过vcgencmd指令查看温度等信息。
  1. //------sensors
  2. //---sensors安装
  3. sudo apt install lm-sensors
  4. //---snesors使用
  5. sensors
  6. //------vcgencmd
  7. //---vcgencmd指令
  8. vcgencmd commands
  9. //---vcgencmd获取温度
  10. vcgencmd measure_temp
  11. //------示例Log信息
  12. zhaomeijing@raspberrypi5:~$ sudo apt install lm-sensors
  13. zhaomeijing@raspberrypi5:~$ sensors
  14. rpi_volt-isa-0000
  15. Adapter: ISA adapter
  16. in0:              N/A

  17. cpu_thermal-virtual-0
  18. Adapter: Virtual device
  19. temp1:        +37.5°C

  20. rp1_adc-isa-0000
  21. Adapter: ISA adapter
  22. in1:         955.00 mV
  23. in2:           2.52 V
  24. in3:           1.40 V
  25. in4:           1.42 V
  26. temp1:        +42.1°C

  27. zhaomeijing@raspberrypi5:~$ vcgencmd commands
  28. 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"
  29. zhaomeijing@raspberrypi5:~$ vcgencmd measure_temp
  30. temp=37.8'C
  31. zhaomeijing@raspberrypi5:~$
复制代码
2.        DDR内存性能测试  
树莓派5开发板采用4GB LPDDR4-SDRAM。
2.1        DDR内存基本信息
通过“free -h”指令读取内存DDR的使用情况;通过/proc/meminfo 文件读取系统中的内存的参数信息。
  1. //------测试工具
  2. free
  3. //---测试指令
  4. free -h
  5. 或者
  6. free -m
  7. //---参数解析
  8. -h 参数代表单位为 GByte
  9. -m 参数代表单位为 MByte
  10. total :内存总量
  11. used :被使用的内存量
  12. free :可使用的内存量
  13. //------查看系统内存信息文件
  14. cat /proc/meminfo

  15. //------
  16. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ free -h
  17.                total        used        free      shared  buff/cache   available
  18. Mem:           4.0Gi       874Mi       477Mi        82Mi       2.8Gi       3.1Gi
  19. Swap:           99Mi          0B        99Mi
  20. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ free -m
  21.                total        used        free      shared  buff/cache   available
  22. Mem:            4045         874         477          82        2840        3170
  23. Swap:             99           0          99
  24. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ cat /proc/meminfo
  25. MemTotal:        4142304 kB
  26. MemFree:          488816 kB
  27. MemAvailable:    3246416 kB
  28. Buffers:          293648 kB
  29. Cached:          2447392 kB
  30. SwapCached:            0 kB
  31. Active:          1915696 kB
  32. Inactive:        1390080 kB
  33. Active(anon):     649056 kB
  34. Inactive(anon):        0 kB
  35. Active(file):    1266640 kB
  36. Inactive(file):  1390080 kB
  37. Unevictable:       41568 kB
  38. Mlocked:              32 kB
  39. SwapTotal:        102384 kB
  40. SwapFree:         102384 kB
  41. Zswap:                 0 kB
  42. Zswapped:              0 kB
  43. Dirty:                 0 kB
  44. Writeback:             0 kB
  45. AnonPages:        606528 kB
  46. Mapped:           259216 kB
  47. Shmem:             84320 kB
  48. KReclaimable:     167568 kB
  49. Slab:             213360 kB
  50. SReclaimable:     167568 kB
  51. SUnreclaim:        45792 kB
  52. KernelStack:        6672 kB
  53. PageTables:        18288 kB
  54. SecPageTables:         0 kB
  55. NFS_Unstable:          0 kB
  56. Bounce:                0 kB
  57. WritebackTmp:          0 kB
  58. CommitLimit:     2173536 kB
  59. Committed_AS:    3168656 kB
  60. VmallocTotal:   68180246528 kB
  61. VmallocUsed:       22672 kB
  62. VmallocChunk:          0 kB
  63. Percpu:             1280 kB
  64. CmaTotal:         327680 kB
  65. CmaFree:          195872 kB
  66. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$
复制代码
2.2        内存功能压力测试-memtester
内存功能压力测试-memtester需要安装:
  1. //------安装内存功能压力测试工具memtester
  2. sudo apt install memtester -y
  3. 或者
  4. sudo apt-get install memtester -y
复制代码
memtester通过给定测试内存的大小和次数, 可以对系统现有的内存进行压力上的测试。例如指定内存大小 512MB,测试次数为 10,则测试命令为“memtester 512M 10"。
下列以使用 512MB 内存空间,单次测试为例:
  1. //------测试工具(MYD-YG2LX系统已带)
  2. memtester
  3. //------测试指令
  4. memtester 512M 1
  5. //---指令说明
  6. 指定内存大小 512MB,测试次数为 1
  7. //---示例
  8. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$ memtester 512M 1
  9. memtester version 4.6.0 (64-bit)
  10. Copyright (C) 2001-2020 Charles Cazabon.
  11. Licensed under the GNU General Public License version 2 (only).

  12. pagesize is 16384
  13. pagesizemask is 0xffffffffffffc000
  14. want 512MB (536870912 bytes)
  15. got  512MB (536870912 bytes), trying mlock ...locked.
  16. Loop 1/1:
  17.   Stuck Address       : ok
  18.   Random Value        : ok
  19.   Compare XOR         : ok
  20.   Compare SUB         : ok
  21.   Compare MUL         : ok
  22.   Compare DIV         : ok
  23.   Compare OR          : ok
  24.   Compare AND         : ok
  25.   Sequential Increment: ok
  26.   Solid Bits          : ok
  27.   Block Sequential    : ok
  28.   Checkerboard        : ok
  29.   Bit Spread          : ok
  30.   Bit Flip            : ok
  31.   Walking Ones        : ok
  32.   Walking Zeroes      : ok
  33.   8-bit Writes        : ok
  34.   16-bit Writes       : ok

  35. Done.
  36. zhaomeijing@raspberrypi5:~/workspace/01_cpu_ddr$
复制代码
3.        蓝牙功能测试(蓝牙键盘)
树莓派5自带蓝牙5.0 /低功耗蓝牙(BLE),手上有一块蓝牙键盘正好用来测试(Device 15:03:02:62:10:C4 BT 5.1 keyboard-1503)。
测试流程和详细日志参考下方:
  1. //------蓝牙软件安装(准备工作,官方系统该镜像已经安装,此处仅作安装说明)
  2. a.先升级软件安装包:
  3. sudo apt-get update
  4. b.下载蓝牙管理工具:
  5. sudo apt-get install bluetooth bluez blueman
  6. //------蓝牙连接使用(测试蓝牙键盘连接)
  7. a.首先使待链接树莓派的蓝牙键盘处于被发现状态;
  8. b.然后扫描蓝牙设备,记录设备蓝牙地址
  9. sudo bluetoothctl scan on
  10. 借助grep指令查找具体某个设备
  11. sudo bluetoothctl scan on | grep "1503"
  12. c.蓝牙配对设备(需要使用设备地址)
  13. sudo bluetoothctl pair Device-Address
  14. sudo bluetoothctl pair 15:03:02:62:10:C4
  15. d.查看蓝牙
  16. bluetoothctl
  17. //------示例Log日志
  18. zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl scan on
  19. zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl list
  20. Controller D8:3A:DD:BF:C2:C7 raspberrypi5 [default]
  21. zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl scan on | grep "1503"
  22. [NEW] Device 15:03:02:62:10:C4 BT 5.1 keyboard-1503
  23. zhaomeijing@raspberrypi5:~/workspace $ sudo bluetoothctl pair 15:03:02:62:10:C4
  24. Attempting to pair with 15:03:02:62:10:C4
  25. [CHG] Device 15:03:02:62:10:C4 Connected: yes
  26. [CHG] Device 15:03:02:62:10:C4 Bonded: yes
  27. [CHG] Device 15:03:02:62:10:C4 Modalias: usb:v0A5Cp8503d011B
  28. [CHG] Device 15:03:02:62:10:C4 UUIDs: 00001000-0000-1000-8000-00805f9b34fb
  29. [CHG] Device 15:03:02:62:10:C4 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
  30. [CHG] Device 15:03:02:62:10:C4 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
  31. [CHG] Device 15:03:02:62:10:C4 ServicesResolved: yes
  32. [CHG] Device 15:03:02:62:10:C4 Paired: yes
  33. Pairing successful
  34. zhaomeijing@raspberrypi5:~/workspace $ bluetoothctl
  35. Agent registered
  36. [bluetooth]#  show
  37. Controller D8:3A:DD:BF:C2:C7 (public)
  38.         Name: raspberrypi5
  39.         Alias: raspberrypi5
  40.         Class: 0x006c0000
  41.         Powered: yes
  42.         Discoverable: no
  43.         DiscoverableTimeout: 0x000000b4
  44.         Pairable: yes
  45.         UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
  46.         UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
  47.         UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
  48.         UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
  49.         UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
  50.         UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
  51.         UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
  52.         UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
  53.         UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
  54.         UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
  55.         Modalias: usb:v1D6Bp0246d0542
  56.         Discovering: no
  57.         Roles: central
  58.         Roles: peripheral
  59. Advertising Features:
  60.         ActiveInstances: 0x00 (0)
  61.         SupportedInstances: 0x05 (5)
  62.         SupportedIncludes: tx-power
  63.         SupportedIncludes: appearance
  64.         SupportedIncludes: local-name
  65. [bluetooth]# devices
  66. Device 15:03:02:62:10:C4 BT 5.1 keyboard-1503
  67. [bluetooth]# exit
  68. zhaomeijing@raspberrypi5:~/workspace $
复制代码


//------end





关注下面的标签,发现更多相似文章
分享到:
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

4013 积分
24 主题
+ 关注
热门推荐
关闭

站长推荐上一条 /3 下一条