|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;6 O* B! E, V2 K5 _7 }4 t8 [
TSCH = 0;
# O+ h9 n" |* K, A unsigned long long start,stop,overhead;( O7 n( O! l8 w$ j" z; ^
start = _itoll(TSCH,TSCL);
: o9 a- b. Q: T: @7 P9 g stop = _itoll(TSCH,TSCL);
' M3 I. G% P* \
: O0 L( ^7 F: I) z' [( B8 V/ j# I9 ~overhead = stop - start;
! A" ~* l+ \$ [% V. Y. Y& ~# u, pprintf("overhead run-time is %d\n",overhead);) M+ a& G0 t3 _* Q1 u
2 @# ^5 Q0 m @2 a: C
start = _itoll(TSCH,TSCL);$ n0 F2 O. ^! t
//here is function
% t; U( F+ W7 t; H5 tfunction();
! v/ o7 Z% g3 p4 G l, nstop = _itoll(TSCH,TSCL);
q, q; f N4 q. w4 R0 Pprintf("The function run-time time is %lu\n",(stop - start - overhead));
& M: S; g% w- q8 @
: R5 T7 t& g% A' a( E$ b' ^$ Q7 G, {5 F2 I
为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。+ u- a5 e. V* u" [7 j
1 C, F; Y- }+ R9 k: P |
|