EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
在DSP671x上使用Timer统计信号处理算法的时间消耗
3 m Z5 d7 r! A5 o6 p, I# W4 a! I代码实例4 i: r8 ]* S3 U
% F7 e; B% q& }/ U- Q- ?hTimer = TIMER_open(TIMER_DEVANY,0); /* open a timer */* d, W! a3 U5 U3 V7 U
+ G; r( `6 q `8 F& F9 V# I
/* Configure the timer. 1 count corresponds to 4 CPU cycles in C67 */
. c: `* o( k0 O; n7 A; _/* control period initial value */" T6 H5 w2 C |7 l
TIMER_configArgs(hTimer, 0x000002C0, 0xFFFFFFFF, 0x00000000);
8 ^' p, b( u% w( r$ P. O; ^& L+ u& v5 E: M! i& Q4 q: q, w% _
/* Compute the overhead of calling the timer. */
$ {6 m8 Y$ l* _! F$ G9 Ostart = TIMER_getCount(hTimer); /* to remove L1P miss overhead */0 p4 C2 f# k0 z0 Y$ t8 Q; [
start = TIMER_getCount(hTimer); /* get count */
, {9 g* l6 G' A* _( ^2 Bstop = TIMER_getCount(hTimer); /* get count */
/ O7 m) K, U8 s h
* M& l7 B8 q( ^* A8 ]7 m, n$ Coverhead = stop - start;
7 J; i4 C+ R' b4 r% _ estart = TIMER_getCount(hTimer); /* get count */2 P/ ?6 ?5 @ I5 l) u
8 ^8 k% G( v# Z- \3 P/* Call a function here. */
0 A: L9 C2 }9 a$ V* X/ _2 G. p7 r) H; Z% y
/* get count */
1 n% l9 h3 T+ F% ]3 Zdiff = (TIMER_getCount(hTimer) – start) ? overhead; 3 M9 w" b0 Q! G$ {& W- G8 I
TIMER_close(hTimer);
2 z6 a! a# b; }* P, iprintf(”%d cycles \n”, diff*4);
* h( G; D& H4 {- F4 A
) C; p4 H1 c' j6 v9 {7 I
( O3 r& r, H; B9 ?' S注意,C6713上定时器的一个计数值对应4个时钟周期。 overhead表示Timer本身配置过程的时钟消耗,所以有diff计算, diff = (TIMER_getCount(hTimer) – start) ? overhead;
! L$ H# Z I( @" i( L V3 @8 R) x2 B m' n- O
|