zynq-7000系列基于zynq-zed双核ARM-Cortex-A9性能的评估测试(多核的使用)

    xiaoxiao2021-03-25  183

    zynq-7000系列基于zynq-zed双核ARM-Cortex-A9性能的评估测试(linux)

                                 

                                 作者:卢浩  

                                       时间:2017.3.8

                                        转载请注明出处

               很多刚接触多核处理器的朋友会问,比如zynq的双核A9,这里的我指的双核是SMP模式,基于linux系统的测试;

               1.第一个问题:双核性能是单核的2倍吗?我的回答,需要看客户实际编程的情况。

               2.第二个问题:我该如何调用多核?我的回答,起多线程就行了,内核会自动调度的。

                我们来做一个test,

                test1:进行5亿次int型加减乘除运算。

                如下:

                

    root@alvin:/work/test/thread# time ./thread7_1 thread_function is running. Argument was 0 using default timnes 500000000! int testing....... begin test + Waiting for threads to finished... + use time:6 begin test - -use time:7 begin test * *use time:7 begin test / / use time:9 ******** test int finished! continue select Bye from 0 Picked up a thread:1 All done real 0m29.669s user 0m29.650s sys 0m0.000s

    这个单线程的计算结果,此时我们可以看一下CPU的占用情况,如下图:

    CPU0满负荷,CPU1几乎处于完全idle状态。

    test2:进行(5*2)亿次int型加减乘除运算

    root@alvin:/work/test/thread# time ./thread7_2 thread_function is running. Argument was 0 using default timnes 500000000! int testing....... begin test + thread_function is running. Argument was 1 using default timnes 500000000! int testing....... begin test + Waiting for threads to finished... + use time:7 begin test - + use time:7 begin test - -use time:7 begin test * -use time:7 begin test * *use time:6 begin test / *use time:7 begin test / / use time:10 ******** test int finished! continue select Bye from 0 / use time:9 ******** test int finished! continue select Bye from 1 Picked up a thread:2 Picked up a thread:1 All done real 0m31.099s user 0m59.400s sys 0m0.000s root@alvin:/work/test/thread# 在几乎同样的时间内,做了5亿*2次的i nt型加减乘除运算。我们可以看到real值,一个是29.6s一个是31.0s。

    此时我们可以看一下CPU状态,如下图:

    CPU0 CPU1都是满负荷运行,CPU1终于不像之前一样闲着了。

    转载请注明原文地址: https://ju.6miu.com/read-7380.html

    最新回复(0)