|
|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;
+ H' B8 A8 q9 [* |. D TSCH = 0;' i; z/ e2 {% p! `, t
unsigned long long start,stop,overhead;9 e b* n- `1 {+ z* f2 S
start = _itoll(TSCH,TSCL);5 I7 p! X6 n( C8 d, }) U" M
stop = _itoll(TSCH,TSCL); - R3 ?) o0 o- B; r. y( u
6 l; h4 W5 h0 Y
overhead = stop - start;5 n1 w, c$ J. N9 ?
printf("overhead run-time is %d\n",overhead);
% n. H7 Q- l0 D- y
0 S: h c. k! kstart = _itoll(TSCH,TSCL);- R9 s7 z. o0 q; n9 ]/ [
//here is function) B) u. N2 f+ @
function();6 b9 u( f7 w8 m$ _8 H# U* B
stop = _itoll(TSCH,TSCL);
* l! b# a: z8 N+ Z dprintf("The function run-time time is %lu\n",(stop - start - overhead));
4 [( ?9 H; l+ } j9 j/ l
: L' C% L/ {: z$ \4 O# V F
8 `3 r6 p" x" ~5 `2 @$ ?# s为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。1 h( `+ ]- k d
) d$ g9 N$ \# A6 g- r
|
|