|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;
( b9 c3 j: s2 ~) | TSCH = 0;
' A: `* M! {# a. c' j9 ?5 r unsigned long long start,stop,overhead;/ y6 O- g7 a$ p) f. n' m+ |( B, q
start = _itoll(TSCH,TSCL);
U8 V! R6 k! o! _ stop = _itoll(TSCH,TSCL);
( E$ Q1 @6 E0 W* a
6 @2 o3 c$ P- b3 R" E0 z8 Boverhead = stop - start;
% T. e( F `$ }4 |6 f* }; o4 G& ?printf("overhead run-time is %d\n",overhead);
1 h$ h. f6 P0 o9 f% Z% r+ I: ~% P- k- l& ]2 V% y) t; b6 N/ g
start = _itoll(TSCH,TSCL);
: M0 m5 F0 q, p; ]" I! k//here is function
/ G4 S5 [3 T: b+ I% e+ [0 d+ U. h0 Bfunction();* C& {3 R. n, x2 f
stop = _itoll(TSCH,TSCL);5 O$ K; v! T. t7 s; K" e8 w) I3 H
printf("The function run-time time is %lu\n",(stop - start - overhead));
1 R$ x, n$ s, p3 D
6 } q' c5 I9 W9 L" G% l3 M* P
5 U5 f; [/ [/ M( x" ^( Z为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。: y9 I; E" v, S- L- x5 G
+ H$ N* g) Q" i; ^, B |
|