Yuano0o / alpaca

0 stars 0 forks source link

时间和一致性测试 #5

Closed Yuano0o closed 1 year ago

Yuano0o commented 1 year ago

时间和一致性测试

分别测试了benchmark的时间(Cycles),及其执行的任务数(total number of tasks).

alpaca

current testbench: 0.Cycles: 717184.the total number of tasks: 17829.
current testbench: 1.Cycles: 771200.the total number of tasks: 905.
current testbench: 2.Cycles: 1325120.the total number of tasks: 1081.
current testbench: 3.Cycles: 384.the total number of tasks: 1.
current testbench: 4.Cycles: 647168.the total number of tasks: 1025.
current testbench: 5.Cycles: 505472.the total number of tasks: 927.
current testbench: 6.Cycles: 1256768.the total number of tasks: 2212.
current testbench: 7.Cycles: 712704.the total number of tasks: 669.
current testbench: 8.Cycles: 1936768.the total number of tasks: 5050.

latics

current testbench: 0.Cycles: 624512.the total number of tasks: 17829.
current testbench: 1.Cycles: 232384.the total number of tasks: 905.
current testbench: 2.Cycles: 1249536.the total number of tasks: 1081.
current testbench: 3.Cycles: 491968.the total number of tasks: 2750.
current testbench: 4.Cycles: 203968.the total number of tasks: 1025.
current testbench: 5.Cycles: 1548096.the total number of tasks: 927.
current testbench: 6.Cycles: 1222720.the total number of tasks: 2212.
current testbench: 7.Cycles: 517696.the total number of tasks: 669.
current testbench: 8.Cycles: 397632.the total number of tasks: 5050.

测试结果和问题

alpaca的cem.c时间和任务数都产生溢出. 除cem.c外,alpaca和latics的benchmark的执行流程一致.

ghost commented 1 year ago

将MCLK的工作频率调整在8MHz(如果需要用到UART,相应地调整UART的参数,与频率对应),SMCLK,即计时器的驱动频率调整到1MHz,分频比保持不变,为64.

void clock_sys_init()
{
    CS_setDCOFreq(CS_DCORSEL_0, CS_DCOFSEL_6);                              // DCO in 8MHz
    CS_initClockSignal(CS_MCLK,   CS_DCOCLK_SELECT,   CS_CLOCK_DIVIDER_1);  // MCLK = DCO = 8MHz
    CS_initClockSignal(CS_SMCLK,  CS_DCOCLK_SELECT,   CS_CLOCK_DIVIDER_8);  // SMCLK = DCO/8 = 1MHz, x8 divided DCO
    CS_initClockSignal(CS_ACLK,   CS_VLOCLK_SELECT,   CS_CLOCK_DIVIDER_1);
    CS_turnOffLFXT();
}

这可以让时间测量的范围较之前再提升8倍(但是精度也会相应变为原来的1/8)。

另外,对于任务数溢出的问题,用float或者uin32_t即可。

Yuano0o commented 1 year ago

任务一致性(已解决)

测试结果

alpaca

current testbench: 0.Cycles: 89664.the total number of tasks: 726.
current testbench: 1.Cycles: 96384.the total number of tasks: 905.
current testbench: 2.Cycles: 165632.the total number of tasks: 1081.
current testbench: 3.Cycles: 109184.the total number of tasks: 2750.
current testbench: 4.Cycles: 80832.the total number of tasks: 1025.
current testbench: 5.Cycles: 63168.the total number of tasks: 927.
current testbench: 6.Cycles: 157056.the total number of tasks: 2212.
current testbench: 7.Cycles: 89024.the total number of tasks: 669.
current testbench: 8.Cycles: 242048.the total number of tasks: 5050.

Latics

current testbench: 0.Cycles: 78080.the total number of tasks: 726.
current testbench: 1.Cycles: 28992.the total number of tasks: 905.
current testbench: 2.Cycles: 156160.the total number of tasks: 1081.
current testbench: 3.Cycles: 61440.the total number of tasks: 2750.
current testbench: 4.Cycles: 25472.the total number of tasks: 1025.
current testbench: 5.Cycles: 193472.the total number of tasks: 927.
current testbench: 6.Cycles: 152832.the total number of tasks: 2212.
current testbench: 7.Cycles: 64704.the total number of tasks: 669.
current testbench: 8.Cycles: 573952.the total number of tasks: 5050.

备注

//alpaca
current testbench: 0.Cycles: 89664.the total number of tasks: 726.
current testbench: 1.Cycles: 96384.the total number of tasks: 905.
current testbench: 2.Cycles: 165632.the total number of tasks: 1081.
current testbench: 3.Cycles: 109184.the total number of tasks: 2750.
current testbench: 4.Cycles: 80832.the total number of tasks: 1025.
current testbench: 5.Cycles: 63168.the total number of tasks: 927.
current testbench: 6.Cycles: 157056.the total number of tasks: 2212.
current testbench: 7.Cycles: 89024.the total number of tasks: 669.
current testbench: 8.Cycles: 242048.the total number of tasks: 5050.
//latics 
//第一个testbench的计数都出现了问题  
current testbench: 0.Cycles: 242048.the total number of tasks: 0.
current testbench: 1.Cycles: 28992.the total number of tasks: 905.
current testbench: 2.Cycles: 156160.the total number of tasks: 1081.
current testbench: 3.Cycles: 61440.the total number of tasks: 2750.
current testbench: 4.Cycles: 25472.the total number of tasks: 1025.
current testbench: 5.Cycles: 193472.the total number of tasks: 927.
current testbench: 6.Cycles: 152832.the total number of tasks: 2212.
current testbench: 7.Cycles: 64704.the total number of tasks: 669.
current testbench: 8.Cycles: 573952.the total number of tasks: 5050.

alpaca: current testbench: 8.Cycles: 242048.the total number of tasks: 5050.

latics(错误点): current testbench: 0.Cycles: 242048.the total number of tasks: 0.