前言
嵌入式平台存储是影响综合性能的重要因素,所以本次对RAM和EMM性能进行测试,RAM压力测试也是一个重要的测试用例,尤其是在高低温等情况下测试,可以考察系统的稳定性。
过程RAM性能测试WSL中 下载代码 cd STREAM/ 编译 ARM-linux-gnueabihf-gcc -O3 stream.c -o stream 导出到windows下 cp stream /mnt/d 添加可执行权限 chmod +x stream 运行 ./stream 结果如下
- [root@EASY-EAI-NANO:/]# ./stream
- -------------------------------------------------------------
- STREAM version $Revision: 5.10 $
- -------------------------------------------------------------
- This system uses 8 bytes per array element.
- -------------------------------------------------------------
- Array size = 10000000 (elements), Offset = 0 (elements)
- Memory per array = 76.3 MiB (= 0.1 GiB).
- Total memory required = 228.9 MiB (= 0.2 GiB).
- Each kernel will be executed 10 times.
- The *best* time for each kernel (excluding the first iteration)
- will be used to compute the reported bandwidth.
- -------------------------------------------------------------
- Your clock granularity/precision appears to be 1 microseconds.
- Each test below will take on the order of 74402 microseconds.
- (= 74402 clock ticks)
- Increase the size of the arrays if this shows that
- you are not getting at least 20 clock ticks per test.
- -------------------------------------------------------------
- WARNING -- The above is only a rough guideline.
- For best results, please be sure you know the
- precision of your system timer.
- -------------------------------------------------------------
- Function Best Rate MB/s Avg time Min time Max time
- Copy: 2213.1 0.072951 0.072296 0.073413
- Scale: 1526.0 0.105517 0.104846 0.108350
- Add: 1181.8 0.203954 0.203082 0.205791
- Triad: 954.5 0.253434 0.251431 0.255541
- -------------------------------------------------------------
- Solution Validates: avg error less than 1.000000e-13 on all three arrays
- -------------------------------------------------------------
- [root@EASY-EAI-NANO:/]#
复制代码
参考https://www.cs.virginia.edu/stream/ref.html RAM压力测试参考 https://pyropus.ca./software/memtester/ WSL中 下载代码 tar -xvf memtester-4.5.1.tar.gz cd memtester-4.5.1/ 编译 arm-linux-gnueabihf-gcc -O3 memtester.c tests.c -o memtester 导出到WINDOWS下,下载到开发板 cp memtester /mnt/d chmod +x memtester 运行 ./memtester 运行结果如下,默认一直测试下去,可以最后指定测试次数 比如 ./memtester 128M 1 128M表示测试RAM大小 1表示测试一次 另外也可以-p直接指定物理地址,适合在板子开发阶段裸机代码直接指定物理地址测试。
- [root@EASY-EAI-NANO:/]# ./memtester 128M 1
- memtester version 4.5.1 (32-bit)
- Copyright (C) 2001-2020 Charles Cazabon.
- Licensed under the GNU General Public License version 2 (only).
-
- pagesize is 4096
- pagesizemask is 0xfffff000
- want 128MB (134217728 bytes)
- got 128MB (134217728 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
-
- Done.
复制代码
EMMC性能测试 dmesg | grep mmc 4GEMMC [ 0.626234] mmc0: new HS200 MMC card at address 0001 [ 0.628264] mmcblk0: mmc0:0001 8GTF4R 7.28 GiB EMMC速度为HS200 df查看,使用/userdata目录进行读写测试
- [root@EASY-EAI-NANO:/]# df
- Filesystem 1K-blocks Used Available Use% Mounted on
- /dev/root 1531442 593804 863917 41% /
- devtmpfs 456488 0 456488 0% /dev
- tmpfs 457000 0 457000 0% /dev/shm
- tmpfs 457000 204 456796 0% /tmp
- tmpfs 457000 380 456620 0% /run
- /dev/mmcblk0p7 127955 1684 122289 1% /oem
- /dev/mmcblk0p8 5632783 38040 5370524 1% /userdata
复制代码
| bs/count 1GB | 指令 | 结果 | 读 | 16k/65536 | time dd if=/userdata/test.bin of=/dev/null bs=16k count=65536 | 109MB/S | 4k/262144 | | | 1k/1048576 | | | 写 | 16k/65536 | time dd if=/dev/zero of=/userdata/test.bin bs=16k count=65536 | 38MB/S | 4k/262144 | | | 1k/1048576 | | |
- [root@EASY-EAI-NANO:/]# time dd if=/dev/zero of=/userdata/test.bin bs=16k count=
- 65536
- 65536+0 records in
- 65536+0 records out
- real 0m 26.85s
- user 0m 0.08s
- sys 0m 16.77s
- [root@EASY-EAI-NANO:/]# time dd if=/userdata/test.bin of=/dev/null bs=16k count=
- 65536
- 65536+0 records in
- 65536+0 records out
- real 0m 9.36s
- user 0m 0.10s
- sys 0m 4.54s
- [root@EASY-EAI-NANO:/]#
复制代码
以上仅作参考,实际欸有考虑缓存的影响。 SD卡性能测试同EMMC测试,测试过程略。 SD卡自动挂载在/mnt/sdcard 总结以上测试来看,性能是不错的,测试方法不是完全科学,比如EMMC读写没有考虑缓存,所以测试结果仅作参考。不同测试环境结果也可能不一样。
|