EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
在DSP671x上使用Timer统计信号处理算法的时间消耗/ X* B; Q6 E7 p$ O3 K' e$ h e0 T
代码实例
$ }* t$ }3 V2 r* W6 k. x8 B; g1 k6 I- }6 M
hTimer = TIMER_open(TIMER_DEVANY,0); /* open a timer */' n6 \; S; g. [6 l
/ x0 X- s0 E* Z/ L8 b7 f& ~3 a7 u
/* Configure the timer. 1 count corresponds to 4 CPU cycles in C67 */
0 }/ A' L* J6 |5 a/* control period initial value */
& O4 {+ ~% E* w7 Y$ wTIMER_configArgs(hTimer, 0x000002C0, 0xFFFFFFFF, 0x00000000);
; a K4 O' Q; ?; k- k, L1 |6 \% h6 W2 b; [, W2 `$ M6 o7 k
/* Compute the overhead of calling the timer. *// X% {* U: Z; S. g* o( V
start = TIMER_getCount(hTimer); /* to remove L1P miss overhead */* r. O5 G0 W% D( g$ J
start = TIMER_getCount(hTimer); /* get count */
; h0 ]) v: Y# _9 kstop = TIMER_getCount(hTimer); /* get count */
& _5 R3 n. X% Q ~& v
1 L0 n9 x( a# b+ w j0 e% z; x$ C) Y2 zoverhead = stop - start;: r6 N" }# L3 w6 a P
start = TIMER_getCount(hTimer); /* get count */
, x4 u5 {) V) a# [9 h8 ^
7 k; ^5 Y* [$ g, m5 K( Z/* Call a function here. */
9 x" w6 f7 y/ M5 V: O [* z- \& r- w0 U X) V: q6 T) U# ~8 ^
/* get count */
6 h/ O) d+ p% | adiff = (TIMER_getCount(hTimer) – start) ? overhead; # {; e% n1 x- |: a* B+ Z
TIMER_close(hTimer);
! D/ I* J$ q8 t( N |7 \5 pprintf(”%d cycles \n”, diff*4);+ B+ y" A. [' P8 }6 B
" U) ^: [4 D! J: z @. h8 I
9 |' H' D4 N% ?+ K3 G注意,C6713上定时器的一个计数值对应4个时钟周期。 overhead表示Timer本身配置过程的时钟消耗,所以有diff计算, diff = (TIMER_getCount(hTimer) – start) ? overhead;2 N2 N& }/ e1 }
( M& ^, Z- w7 y; @ |