|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;1 c& w/ ^+ |7 n4 Y# |3 s0 y/ e
TSCH = 0;2 F2 f4 p& r6 g) |* }- r: d" F
unsigned long long start,stop,overhead;% e' Z/ S4 N M3 b6 _
start = _itoll(TSCH,TSCL);/ I5 b' k9 z1 |# b M: q. Z
stop = _itoll(TSCH,TSCL);
8 Z0 g/ |" f' A& ^. v6 M% l' g! [- s2 T' M/ M- F {
overhead = stop - start;% f' I6 W' G9 n" H( R# @; G
printf("overhead run-time is %d\n",overhead);$ z) y! N4 F$ c
; p9 s6 t) B+ y0 t' ?3 |3 ^. xstart = _itoll(TSCH,TSCL);
1 Z/ G8 k& {- V4 z6 |! k//here is function
0 m7 k; Y8 S; mfunction();
& B9 _3 `4 B+ b. Tstop = _itoll(TSCH,TSCL);
6 c: o3 [8 V6 d; D6 wprintf("The function run-time time is %lu\n",(stop - start - overhead));
7 t4 u% d, x* |2 ]/ m0 n
+ |* b$ u! V& K2 B
( w8 f! ~# K; q! m为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。4 b, p9 x/ N. R, z
' T: [" H+ m# O: H; Y' z- X& e |
|