Yuano0o / alpaca

0 stars 0 forks source link

时间测试问题 #6

Closed Yuano0o closed 1 year ago

Yuano0o commented 1 year ago

时间测试

  1. 时间测试放在哪里更合适? 图1还是图2?

_SWQG 01I%@_PB1D@~R_QCP

CP51DCDIVXB%@I%Y 22Q7D4

  1. 问题

如果连续调用latics()alpaca()并测试时间.尽管这里采用了不同的局部变量:

main()
    Alpaca_only();  
        uint16_t s, f; 
        timer_start_count(&s);
        timer_end_count(&f);
        timer_get_cycles(s, f) 
    Periodic_only();
        uint16_t a, b;
        timer_start_count(&a);
        timer_end_count(&b);
        timer_get_cycles(a, b) 

还是会出现下面的结果:

current testbench: 8.Cycles: 1916608. //alpaca的最后一个benchmark
current testbench: 0.Cycles: 1916608. //latics的第一个benchmark, 读取的cycle是上一个cycle值.
current testbench: 1.Cycles: 228800. //后续正常

对于任务的计数也有同样的问题,为了方便,对task_count使用了全局变量,但把task_count换成volatile task_count 后,任务计数恢复正常.是编译器优化的问题吗?

ghost commented 1 year ago

我们实际上要测量更多的数据

A1:对于不断电的情况,这两种测量方法无差,保持一致性,即所有testbench都使用同样的方法即可。

在断电时,时间的测量更为复杂,需要额外的中控程序来进行测量。

A2:第二个问题我不是很清楚描述的具体意思。