10-06-2016, 08:24 AM
Macro Macro274
int n tOSD=timeGetTime; long tSum
rep
,long t1=perf
,sub.Func
,long t2=perf
,
,n+1; tSum+(t2-t1)
,int tNow=timeGetTime
,if tNow-tOSD>=100 ;;update OSD every 100 ms
,,OnScreenDisplay F"{tSum/n}" -1 0 0 "" 0 0 4|8 "time" ;;show average sub.Func time during the last 100 ms
,,tSum=0; n=0; tOSD=tNow
,
,0.001
#sub Func
;this function consumes CPU 100 to 1000 microseconds
long t0(perf) time=RandomInt(100 1000)
rep
,if(perf-t0>=time) break