在 ST 官网上查看 MCU 的介绍时,经常会看到下面的数据,例如 STM32F103的介绍:
Dhrystone
最新的源码可以在这里:https://www.netlib.org/benchmark/dhry-c 找到,虽说是最新,其实也有几十年历史了,这个链接里不仅包含了介绍,也可以直接生成源码:
1$ curl https://www.netlib.org/benchmark/dhry-c > dhry-c.sh
2$ chmod u+x dhry-c.sh
3$ ./dhry-c.sh
这样就可以看到目录下生成了源码和介绍了:
1.
2├── RATIONALE
3├── README_C
4├── VARIATIONS
5├── dhry-c.sh
6├── dhry.h
7├── dhry_1.c
8├── dhry_2.c
9├── dhry_c.dif
10└── submit.frm
1RT-Thread online packages
2 tools packages --->
3 [*] DHRYSTONE: a benchmark that measures the performance of MCUs and CPUs.
选中软件包并编译,就可以在 msh 下输入:
1msh> dhrystone_test
STM32F103 (ARMCC -O3 -Otime) 跑分: 79 DMIPS & 1.09 DMIPS/MHz
1 \ | /
2- RT - Thread Operating System
3 / | \ 4.0.2 build Oct 15 2019
4 2006 - 2019 Copyright by rt-thread team
5msh >
6msh >dhrystone_test
7
8Dhrystone Benchmark, Version 2.1 (Language: C)
9
10Program compiled without 'register' attribute
11
12Execution starts, 320000 runs through Dhrystone
13Execution ends
14
15Final values of the variables used in the benchmark:
16
17Int_Glob: 5
18 should be: 5
19Bool_Glob: 1
20 should be: 1
21Ch_1_Glob: A
22 should be: A
23Ch_2_Glob: B
24 should be: B
25Arr_1_Glob[8]: 7
26 should be: 7
27Arr_2_Glob[8][7]: 320010
28 should be: Number_Of_Runs + 10
29Ptr_Glob->
30 Ptr_Comp: 536892000
31 should be: (implementation-dependent)
32 Discr: 0
33 should be: 0
34 Enum_Comp: 2
35 should be: 2
36 Int_Comp: 17
37 should be: 17
38 Str_Comp: DHRYSTONE PROGRAM, SOME STRING
39 should be: DHRYSTONE PROGRAM, SOME STRING
40Next_Ptr_Glob->
41 Ptr_Comp: 536892000
42 should be: (implementation-dependent), same as above
43 Discr: 0
44 should be: 0
45 Enum_Comp: 1
46 should be: 1
47 Int_Comp: 18
48 should be: 18
49 Str_Comp: DHRYSTONE PROGRAM, SOME STRING
50 should be: DHRYSTONE PROGRAM, SOME STRING
51Int_1_Loc: 5
52 should be: 5
53Int_2_Loc: 13
54 should be: 13
55Int_3_Loc: 7
56 should be: 7
57Enum_Loc: 1
58 should be: 1
59Str_1_Loc: DHRYSTONE PROGRAM, 1'ST STRING
60 should be: DHRYSTONE PROGRAM, 1'ST STRING
61Str_2_Loc: DHRYSTONE PROGRAM, 2'ND STRING
62 should be: DHRYSTONE PROGRAM, 2'ND STRING
63
64Microseconds for one run through Dhrystone: 7
65Dhrystones per Second: 139130
66VAX MIPS rating: 79
GD32VF103CB (GCC -Os) 跑分: 50 DMIPS & 0.46 DMIPS/MHz
1 \ | /
2- RT - Thread Operating System
3 / | \ 4.0.2 build Oct 14 2019
4 2006 - 2019 Copyright by rt-thread team
5msh >
6msh >dhrystone_test
7
8Dhrystone Benchmark, Version 2.1 (Language: C)
9
10Program compiled without 'register' attribute
11
12Execution starts, 320000 runs through Dhrystone
13Execution ends
14
15Final values of the variables used in the benchmark:
16
17Int_Glob: 5
18 should be: 5
19Bool_Glob: 1
20 should be: 1
21Ch_1_Glob: A
22 should be: A
23Ch_2_Glob: B
24 should be: B
25Arr_1_Glob[8]: 7
26 should be: 7
27Arr_2_Glob[8][7]: 320010
28 should be: Number_Of_Runs + 10
29Ptr_Glob->
30 Ptr_Comp: 536884636
31 should be: (implementation-dependent)
32 Discr: 0
33 should be: 0
34 Enum_Comp: 2
35 should be: 2
36 Int_Comp: 17
37 should be: 17
38 Str_Comp: DHRYSTONE PROGRAM, SOME STRING
39 should be: DHRYSTONE PROGRAM, SOME STRING
40Next_Ptr_Glob->
41 Ptr_Comp: 536884636
42 should be: (implementation-dependent), same as above
43 Discr: 0
44 should be: 0
45 Enum_Comp: 1
46 should be: 1
47 Int_Comp: 18
48 should be: 18
49 Str_Comp: DHRYSTONE PROGRAM, SOME STRING
50 should be: DHRYSTONE PROGRAM, SOME STRING
51Int_1_Loc: 5
52 should be: 5
53Int_2_Loc: 13
54 should be: 13
55Int_3_Loc: 7
56 should be: 7
57Enum_Loc: 1
58 should be: 1
59Str_1_Loc: DHRYSTONE PROGRAM, 1'ST STRING
60 should be: DHRYSTONE PROGRAM, 1'ST STRING
61Str_2_Loc: DHRYSTONE PROGRAM, 2'ND STRING
62 should be: DHRYSTONE PROGRAM, 2'ND STRING
63
64Microseconds for one run through Dhrystone: 11
65Dhrystones per Second: 89385
66VAX MIPS rating: 50
参考资料
Dhrystone 软件包:
https://github.com/wuhanstudio/dhrystone
Dhrystone 测试结果汇总:
http://performance.netlib.org/performance/html/dhrystone.data.col0.html
Dhrystone 历史源码:
https://github.com/Keith-S-Thompson/dhrystone
Coremark
虽然在 ST 的官网上都会放有 Dhrystone 的测试结果,但是不得不说作为一个历史悠久的性能测试工具,它还是有很多弊端的,为此 eembc 推出了新的性能测试工具 Coremark,相比 Dhrystone 有不少改进:
1RT-Thread online packages
2 tools packages --->
3 [*] COREMARK : a benchmark that measures the performance of MCUs and CPUs.
选中软件包并编译,就可以在 msh 下输入:
1msh> core_mark
1 \ | /
2- RT - Thread Operating System
3 / | \ 4.0.2 build Oct 13 2019
4 2006 - 2019 Copyright by rt-thread team
5msh >
6msh >core_mark
7Benchmark started, please make sure it runs for at least 10s.
8
92K performance run parameters for coremark.
10CoreMark Size : 666
11Total ticks : 17776
12Total time (secs): 17.776000
13Iterations/Sec : 135.013501
14Iterations : 2400
15Compiler version : Please put compiler version here (e.g. gcc 4.1)
16Compiler flags :
17Memory location : STACK
18seedcrc : 0xe9f5
19[0]crclist : 0xe714
20[0]crcmatrix : 0x1fd7
21[0]crcstate : 0x8e3a
22[0]crcfinal : 0x382f
23Correct operation validated. See README.md for run and reporting rules.
24CoreMark 1.0 : 135.013501 / Please put compiler version here (e.g. gcc 4.1) / STACK
25
GD32VF103 (108MHz) GCC -Os 跑分 327:
1 \ | /
2- RT - Thread Operating System
3 / | \ 4.0.2 build Oct 13 2019
4 2006 - 2019 Copyright by rt-thread team
5msh >
6msh >core_mark
7Benchmark started, please make sure it runs for at least 10s.
8
92K performance run parameters for coremark.
10CoreMark Size : 666
11Total ticks : 1178
12Total time (secs): 11
13Iterations/Sec : 327
14Iterations : 3600
15Compiler version : GCC8.2.0
16Compiler flags :
17Memory location : STACK
18seedcrc : 0xe9f5
19[0]crclist : 0xe714
20[0]crcmatrix : 0x1fd7
21[0]crcstate : 0x8e3a
22[0]crcfinal : 0x4bfc
23Correct operation validated. See README.md for run and reporting rules.
24CoreMark 1.0 : 327 / GCC8.2.0 / STACK
25
最终得分当然是越高越好了,为了得到有效的测试结果,需要确保测试运行 10s 以上,可以修改 menuconfig 里的迭代次数,来匹配你的 MCU。更多测试结果可以在官网里找到。
参考资料
Coremark 软件包:
https://github.com/wuhanstudio/coremark
Coremark 测试结果汇总:
https://www.eembc.org/coremark/scores.php
Coremark 官网:
https://www.eembc.org/coremark/
注意事项
1.2019年RT-Thread开发者大会来袭,参与赢四重好礼
3.NXP全能型MCU主打通用嵌入式和工业物联网市场,你用得上吗?
免责声明:本文系网络转载,版权归原作者所有。如涉及作品版权问题,请与我们联系,我们将根据您提供的版权证明材料确认版权并支付稿酬或者删除内容。