1.CLA进行计数i++直至i=100000,计时其运算的时间t1
2.CPU进行计数n++直至n=100000,计时其运算的时间t2
3.CPU单独计算i++与n++,直至i=100000,n=100000,计时其运算的时间t
若t1或t2小于t,则说明CLA与CPU是并行的。
现问题是如何计时t1与t2
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
1.CLA进行计数i++直至i=100000,计时其运算的时间t1
2.CPU进行计数n++直至n=100000,计时其运算的时间t2
3.CPU单独计算i++与n++,直至i=100000,n=100000,计时其运算的时间t
若t1或t2小于t,则说明CLA与CPU是并行的。
现问题是如何计时t1与t2
是的,我也想到了这样的方法,按照如下代码来运行,
CpuTimer0Regs.TCR.bit.TSS = 0;
test_run();
CpuTimer0Regs.TCR.bit.TSS = 1;
n=CpuTimer0Regs.TIM.all;
但是出现计数器n的值随着程序语句的增多而减小