|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;
( n, A: x" i2 }' v: P9 b4 Z TSCH = 0;
0 G! S O; z0 i/ w- W9 k- { unsigned long long start,stop,overhead;
^9 ] t9 _! @* i start = _itoll(TSCH,TSCL);- C: J4 n; S$ u2 R* s' @
stop = _itoll(TSCH,TSCL);
, |/ r7 _4 B4 o1 @" E
5 j0 t/ L3 j3 j8 Joverhead = stop - start;
3 P* f y- b* A8 uprintf("overhead run-time is %d\n",overhead);
' w% _4 y# {$ J9 A& s$ k/ p3 y" v' X* ~; u
start = _itoll(TSCH,TSCL);3 I; N* s2 ^; E
//here is function
$ N7 H7 ?) w& _( P* W! }function();
$ y/ e' G# h2 Jstop = _itoll(TSCH,TSCL);* y, {) r* V5 w @. U9 |$ A: G( x
printf("The function run-time time is %lu\n",(stop - start - overhead));
; ~* M# g% F* t* }5 P
Y: N) y9 U9 Z/ s2 u' O: a! w1 j& b" G, `2 G" k7 `9 R
为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。
' O2 x9 V+ o1 \/ _, f9 z! V7 k% i7 W
|
|