歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

在DSP671x上使用Timer統計信號處理算法的時間消耗

代碼實例
 
hTimer = TIMER_open(TIMER_DEVANY,0); /* open a timer */

/* Configure the timer. 1 count corresponds to 4 CPU cycles in C67 */
/* control period initial value */
TIMER_configArgs(hTimer, 0x000002C0, 0xFFFFFFFF, 0x00000000);

/* Compute the overhead of calling the timer. */
start = TIMER_getCount(hTimer); /* to remove L1P miss overhead */
start = TIMER_getCount(hTimer); /* get count */
stop = TIMER_getCount(hTimer); /* get count */

overhead = stop - start;
start = TIMER_getCount(hTimer); /* get count */

/* Call a function here. */

/* get count */
diff = (TIMER_getCount(hTimer) – start) ? overhead;
TIMER_close(hTimer);
printf(”%d cycles \n”, diff*4);

 
注意,C6713上定時器的一個計數值對應4個時鐘周期。
 
overhead表示Timer本身配置過程的時鐘消耗,所以有diff計算,
 
diff = (TIMER_getCount(hTimer) – start) ? overhead; /* get count */

Copyright © Linux教程網 All Rights Reserved