|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;# @$ H6 |4 q9 r# q% R
TSCH = 0;- c, @& T: E$ J* u9 q
unsigned long long start,stop,overhead;
8 ^, i, |; h. ~2 e start = _itoll(TSCH,TSCL);
~ p7 p: f- C' q stop = _itoll(TSCH,TSCL); / |# D# y6 k M
2 \1 A2 I, [5 u4 _ N! e/ t- F, T
overhead = stop - start;+ b$ @: X5 B, t0 G/ @$ v7 i
printf("overhead run-time is %d\n",overhead);8 I9 @6 d; l7 m W; o0 [
2 S& b: e6 R' l* N3 y9 Y
start = _itoll(TSCH,TSCL);1 V4 y, Z5 d! |# j
//here is function
! F2 K" q. T4 Q* M: g6 f1 Nfunction();8 d; N9 Y8 W. R @" g; {9 Z
stop = _itoll(TSCH,TSCL);0 z8 c$ C2 T: l, A! x8 R- d7 g0 L
printf("The function run-time time is %lu\n",(stop - start - overhead));
$ l4 }9 K# Y. ^+ R4 r ^# m
N4 Z4 A9 }, V( h
5 I% q4 B: z! f8 ?( c- Z/ u& p/ h为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。
, j! j1 w* g& a; S0 c* ^, {
7 P3 d% T( o) c7 j* V |
|