EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
在DSP671x上使用Timer统计信号处理算法的时间消耗
2 t) E3 A/ |& a l0 \7 p代码实例
: W) K; @% ~0 ^- s4 ]$ D6 e# t4 z! D8 v
hTimer = TIMER_open(TIMER_DEVANY,0); /* open a timer */
, X" s- `( k; H u$ r
+ d# X) L1 U% m5 p" Z0 e/* Configure the timer. 1 count corresponds to 4 CPU cycles in C67 */! A v1 F& \# `. L& T1 X: f
/* control period initial value */
9 ]7 x j) F- E# S+ CTIMER_configArgs(hTimer, 0x000002C0, 0xFFFFFFFF, 0x00000000);& S# t4 r+ s( }
9 G6 {' ]* H' B+ \) y& ^
/* Compute the overhead of calling the timer. */
6 L4 \. s! J% ^ C6 o V* F8 }) e6 @start = TIMER_getCount(hTimer); /* to remove L1P miss overhead */
( r# N" x/ ?) nstart = TIMER_getCount(hTimer); /* get count */
8 {7 [' A' E- R4 ~$ Fstop = TIMER_getCount(hTimer); /* get count */
$ G; R# d# X: D2 I$ q v
. @, y! b3 x9 J; K9 voverhead = stop - start;
/ t4 ^7 [0 ^1 a, ?start = TIMER_getCount(hTimer); /* get count */. [- S7 J/ b' S6 b
. y1 |! x+ @# p! n g5 O
/* Call a function here. */& p- _- I- ]2 t5 V& P" A" z
* V5 g" ~ b( y) f/* get count */
+ N; Z! g2 g; B$ Ydiff = (TIMER_getCount(hTimer) – start) ? overhead;
2 [; w; b) y) d7 CTIMER_close(hTimer);
# e, ~* X0 N3 Tprintf(”%d cycles \n”, diff*4);
) u, j# A+ N% |
3 }6 q" R0 }7 W/ _9 w: I; b
( b% X0 T' N1 A) }/ w9 K注意,C6713上定时器的一个计数值对应4个时钟周期。 overhead表示Timer本身配置过程的时钟消耗,所以有diff计算, diff = (TIMER_getCount(hTimer) – start) ? overhead;
+ h6 \$ Y. m9 `2 e" [% S5 `+ \) U- O' d: \( S# H9 ]
|