|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;* K* y y9 J8 @/ H
TSCH = 0;
5 X- H/ i! Q! K" Q1 B unsigned long long start,stop,overhead;# f2 o1 _; e$ t! R! ~5 [# ?
start = _itoll(TSCH,TSCL);/ g3 g' m& g# o4 V& U, U
stop = _itoll(TSCH,TSCL); & d) N; B6 w G3 N! ]6 K" S
+ O& y7 ^ B! n4 O! O j/ G
overhead = stop - start; Q3 Q8 h. b6 k
printf("overhead run-time is %d\n",overhead);
4 ^& G8 q' K- x) Z+ A* J* z! P7 T* |7 Z! X2 j' B% U& x
start = _itoll(TSCH,TSCL);% s6 w9 x1 }0 A5 m/ F
//here is function
1 \" W% j, t) M' y& Cfunction();1 T) W/ b7 {/ Z: @& {# g
stop = _itoll(TSCH,TSCL);
( P& T- a/ S+ u1 s0 s7 L* Qprintf("The function run-time time is %lu\n",(stop - start - overhead));/ E& @8 k" x8 w. M. s- t
# l- k3 Z) r& B% L
& z1 u+ L/ A8 N1 ^6 r7 ]" `为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。
) P0 K6 x0 ]: d4 S( B# P/ N7 W; q- y& ~
|
|