EEMBC 的 CoreMark® 评分是一种比较通用的基准测试方式,用于测量嵌入式系统中使用的微控制器(MCU)和中央处理单元(CPU)的性能,可以帮助人们比较不同的 CPU 架构的性能表现。
![eembc25.png](//file1.elecfans.com/web2/M00/A8/92/wKgZomUgKL2AFRLWAABNNOAuKAU937.png)
CoreMark 基准评分特点
CRC 算法具有双重功能,在链表元素中包含的数据上执行16位CRC,以验证操作正确,保证操作正确并提供自我检查机制。
为了确保编译器不能在编译时预先计算结果,基准测试中的每个操作都会产生一个在编译时不可用的值。此外,基准测试中定时部分使用的所有代码都是基准测试本身的一部分(没有库调用)。
CoreMark 是一种基于 C 语言的 CPU 性能评测工具,其目标是为了提供一个可重复、可移植且各平台间性能得分可比较的基准测试。CoreMark 包含多个小型测试,旨在模拟实际应用程序中常见的操作和趋势。
一、下载&编译
既然基于C,那就直接在板上编译好了。git clone https://github.com/eembc/coremark.git
直接把代码从gethub上撸下来,可能网络故障,需要多试几次。
![CM1.png](//file1.elecfans.com/web2/M00/A6/CC/wKgaomUgKVOAcHMuAAEP-rKHttQ761.png)
本地编译好办,先看看gcc版本。
linaro@linaro-alip:~/coremark$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/8/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --disable-libphobos --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)
免去交叉编译的麻烦,直接make
即可。
linaro@linaro-alip:~/coremark$ make
make XCFLAGS=" -DPERFORMANCE_RUN=1" load run1.log
make[1]: Entering directory '/home/linaro/coremark'
make port_prebuild
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_prebuild'.
make[2]: Leaving directory '/home/linaro/coremark'
make link
make[2]: Entering directory '/home/linaro/coremark'
cc -O2 -Ilinux -Iposix -I. -DFLAGS_STR=\""-O2 -DPERFORMANCE_RUN=1 -lrt"\" -DITERATIONS=0 -DPERFORMANCE_RUN=1 core_list_join.c core_main.c core_matrix.c core_state.c core_util.c posix/core_portme.c -o ./coremark.exe -lrt
Link performed along with compile
make[2]: Leaving directory '/home/linaro/coremark'
make port_postbuild
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_postbuild'.
make[2]: Leaving directory '/home/linaro/coremark'
make port_preload
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_preload'.
make[2]: Leaving directory '/home/linaro/coremark'
echo Loading done ./coremark.exe
Loading done ./coremark.exe
make port_postload
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_postload'.
make[2]: Leaving directory '/home/linaro/coremark'
make port_prerun
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_prerun'.
make[2]: Leaving directory '/home/linaro/coremark'
./coremark.exe 0x0 0x0 0x66 0 7 1 2000 > ./run1.log
make port_postrun
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_postrun'.
make[2]: Leaving directory '/home/linaro/coremark'
make[1]: Leaving directory '/home/linaro/coremark'
make XCFLAGS=" -DVALIDATION_RUN=1" load run2.log
make[1]: Entering directory '/home/linaro/coremark'
make port_preload
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_preload'.
make[2]: Leaving directory '/home/linaro/coremark'
echo Loading done ./coremark.exe
Loading done ./coremark.exe
make port_postload
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_postload'.
make[2]: Leaving directory '/home/linaro/coremark'
make port_prerun
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_prerun'.
make[2]: Leaving directory '/home/linaro/coremark'
./coremark.exe 0x3415 0x3415 0x66 0 7 1 2000 > ./run2.log
make port_postrun
make[2]: Entering directory '/home/linaro/coremark'
make[2]: Nothing to be done for 'port_postrun'.
make[2]: Leaving directory '/home/linaro/coremark'
make[1]: Leaving directory '/home/linaro/coremark'
Check run1.log and run2.log for results.
See README.md for run and reporting rules.
生成coremark.exe ,奇怪了,这种.exe命名不是windows才有的吗?Linux/GNU很少用这种方式。anyway,先看看可执行文件。
linaro@linaro-alip:~/coremark$ file coremark.exe
coremark.exe: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=ba590f0bbe7fe0273ccd6026c9fa18352507e4c0, not stripped
二、跑分
./coremark.exe
跑跑,估计等过10s的样子。
![CM2.png](//file1.elecfans.com/web2/M00/A8/92/wKgZomUgKxCAYaRPAAF83sswXMM319.png)
GCC8.3.0 -O2 -lrt / Heap 级别上,跑了接近7000分。
三、对比
这个成绩怎么样呢?来对比下。
![CM3.png](//file1.elecfans.com/web2/M00/A8/92/wKgZomUgLA-AXae6AACncCLFkkE004.png)
对比起来还是挺不错的,再来看看常见开发板的跑分情况。
![CM4.png](//file1.elecfans.com/web2/M00/A6/CC/wKgaomUgLD-AbjttAAJDpEBtQOc646.png)