|
|
用的是创龙的OMAP-L138的板子和XDS100v3仿真器,用的方法是TSCL = 0;
+ {. Z$ X3 ^0 ?# e7 c TSCH = 0;- k5 l; k9 @, x
unsigned long long start,stop,overhead;
8 g% T7 k5 z( j4 H# q1 r+ Y+ m start = _itoll(TSCH,TSCL);( r: w4 L# L1 Z" t5 u1 w
stop = _itoll(TSCH,TSCL);
8 A' J$ W2 ?. I( K7 [- h, B5 b+ Q$ f5 K: a4 m: V" q2 r& T
overhead = stop - start;. M; n3 J) F. n% `4 y( c
printf("overhead run-time is %d\n",overhead);
. J$ B4 @. u! ^! N |) W
. S& j1 Z8 A: @1 |' R$ N, Dstart = _itoll(TSCH,TSCL);
Q0 J' I# e% e7 s6 V, x8 U//here is function
; Y9 f7 R, u ]! N& b- p4 A% _function();2 F% F4 W! Z e2 b0 H
stop = _itoll(TSCH,TSCL);
! W5 N3 p! e- z% dprintf("The function run-time time is %lu\n",(stop - start - overhead));$ ^0 [$ S' S; H' p' q: b1 t" {
6 q$ ~) K; e9 ~9 }5 M( l
. w0 G4 K0 y6 X5 f8 @8 |为什么每次测量出来的时间都不一致?测量出来的不是一个固定的值。
0 t; {1 i9 j# i1 i: M7 P$ ~
- e3 }: Y7 t' n2 I: \) { |
|