EDA365电子论坛网
标题:
在DSP671x上使用Timer统计信号处理的时间消耗算法
[打印本页]
作者:
pulbieup
时间:
2019-8-14 09:30
标题:
在DSP671x上使用Timer统计信号处理的时间消耗算法
代码实例
$ V2 j, B' I$ f$ p. }7 ?
6 h- l# m" j0 ~4 U9 h0 }4 Q, y
, s$ A8 x" s- `! W. E
hTimer = TIMER_open(TIMER_DEVANY,0); /* open a timer */
& [$ l! T: D: ?6 y
/* Configure the timer. 1 count corresponds to 4 CPU cycles in C67 */
/* control period initial value */
TIMER_configArgs(hTimer, 0x000002C0, 0xFFFFFFFF, 0x00000000);
; }7 L# H" F4 s. T3 H$ C
/* 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 */
- z& D; r- v5 N# Y, T5 r! j2 j+ c
overhead = stop - start;
start = TIMER_getCount(hTimer); /* get count */
* X/ a& e* l- z4 S
/* Call a function here. */
( r" F' d- E0 a, @% W. j: T
/* get count */
diff = (TIMER_getCount(hTimer) – start) ? overhead;
TIMER_close(hTimer);
printf(”%d cycles \n”, diff*4);
% n' x) B5 `+ n* ~: ^# @- f
# M6 W$ |1 x3 c4 ~$ e, P
- F3 k2 ~3 x: m) K
1 {: N n0 F" h1 v: u
! M9 i& @5 V" Y
注意,C6713上定时器的一个计数值对应4个时钟周期。
4 c) Y' D+ K4 E( g% W
& [: U, U1 E* u8 M
* c* R" N8 v; K4 G3 p' B
overhead表示Timer本身配置过程的时钟消耗,所以有diff计算,
7 V$ D/ |; M$ Z2 n( m
/ ]" _7 _/ f# V5 _7 @7 P. A
! B* A, ], ]; r J0 ~5 w! a
diff = (TIMER_getCount(hTimer) – start) ? overhead; /* get count */
$ q2 g+ Y( {6 y0 s. C$ o2 g, _
! c& N+ X1 D+ T9 g
, B( M% T d* t
: H' d' c: Z W
4 W V b) x+ ?! g7 a( c0 |6 \
作者:
fanichicl
时间:
2019-8-14 18:47
看看。
欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/)
Powered by Discuz! X3.2