dhrystone测试结果_RTThread软件包可以对MCU进行性能测试,跑一个试试!
在 ST 官網上查看 MCU 的介紹時,經常會看到下面的數據,例如 STM32F103的介紹:
上面的 1.25 DMIPS/MHz 代表什么意思,又是如何得到的呢?這就是 CPU 性能測試 (benchmark) 小工具 Dhrystone 測試得到的。Dhrystone
Dhrystone 是 1984 年由 Reinhold P. Weicker 提出的通用處理器 (CPU) 性能測試標準,最早用 ADA 實現,隨后 Rick Richardson 把它翻譯為 C 語言,并很快成為了業界標準。不過 Dhdrystone 只測試整型運算,并不包含浮點運算,因此無法用它來判斷 FPU 的性能。最新的源碼可以在這里:https://www.netlib.org/benchmark/dhry-c 找到,雖說是最新,其實也有幾十年歷史了,這個鏈接里不僅包含了介紹,也可以直接生成源碼:
1$?curl?https://www.netlib.org/benchmark/dhry-c?>?dhry-c.sh2$?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
當然,如果是在 RT-Thread 平臺的話,直接在 env 下面 menuconfig 就可以找到 Dhrystone 軟件包了: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
順便一提,如果沒有看到測試結果,可能是你的 MCU 太強勁了,一下就跑完了所有的測試,以至于沒有得到有效的結果;或者 msh 控制臺卡死很久沒有得到結果,多半是你的 MCU 太慢了。這種情況下都可以修改 menuconfig 里的迭代次數,來匹配你的 MCU。更多測試結果可以在下面的參考資料里找到。
參考資料
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 有不少改進:
Coremark 的主頁可以在這里:https://www.eembc.org/coremark/找到,上面 Coremark 相比 Dhrystone 優點的截圖也是從官網截取的,當然也可以從官網上找到最新的源碼和測試結果。當然,如果是在 RT-Thread 平臺的話,直接在 env 下面 menuconfig 就可以找到 Coremark 軟件包了:1RT-Thread?online?packages2??tools?packages??--->
3??????[*]?COREMARK?:?a?benchmark?that?measures?the?performance?of?MCUs?and?CPUs.
選中軟件包并編譯,就可以在 msh 下輸入:
1msh>?core_mark就可以看到跑分結果了,例如:STM32F103RC (72MHZ) ARMCC -O3 -Otime 跑分 135: 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.77600013Iterations/Sec???:?135.01350114Iterations???????:?240015Compiler?version?:?Please?put?compiler?version?here?(e.g.?gcc?4.1)16Compiler?flags???:17Memory?location??:?STACK18seedcrc??????????:?0xe9f519[0]crclist???????:?0xe71420[0]crcmatrix?????:?0x1fd721[0]crcstate??????:?0x8e3a22[0]crcfinal??????:?0x382f23Correct?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)??/?STACK25
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):?1113Iterations/Sec???:?32714Iterations???????:?360015Compiler?version?:?GCC8.2.016Compiler?flags???:17Memory?location??:?STACK18seedcrc??????????:?0xe9f519[0]crclist???????:?0xe71420[0]crcmatrix?????:?0x1fd721[0]crcstate??????:?0x8e3a22[0]crcfinal??????:?0x4bfc23Correct?operation?validated.?See?README.md?for?run?and?reporting?rules.24CoreMark?1.0?:?327?/?GCC8.2.0??/?STACK25
最終得分當然是越高越好了,為了得到有效的測試結果,需要確保測試運行 10s 以上,可以修改 menuconfig 里的迭代次數,來匹配你的 MCU。更多測試結果可以在官網里找到。
參考資料
Coremark 軟件包:
https://github.com/wuhanstudio/coremark
Coremark 測試結果匯總:
https://www.eembc.org/coremark/scores.php
Coremark 官網:
https://www.eembc.org/coremark/
注意事項
不得不說,無論是 Dhrystone 還是 Coremark,編譯器的優化選項對測試結果影響都是比較大的,如果你的測試結果與官網的結果略有不同,可以看看是不是自己沒有打開編譯器的優化選項。1.2019年RT-Thread開發者大會來襲,參與贏四重好禮
2.來自BAT大??偨Y的常用設計模式匯總~
3.NXP全能型MCU主打通用嵌入式和工業物聯網市場,你用得上嗎?
4.關于8位MCU產品的十大誤解
5.物聯網的兩大焦慮,Qorvo打包來解決!
6.GitHub啟動代碼永久保存計劃,至少一千年!
免責聲明:本文系網絡轉載,版權歸原作者所有。如涉及作品版權問題,請與我們聯系,我們將根據您提供的版權證明材料確認版權并支付稿酬或者刪除內容。
總結
以上是生活随笔為你收集整理的dhrystone测试结果_RTThread软件包可以对MCU进行性能测试,跑一个试试!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: creator找不到编译器 qt_VS2
- 下一篇: 密码可见_教你如何批量删除微博、设置仅自