01-09-2005, 08:55 AM
This method allows to see how long one or several commands run, with precision of 1 microsecond (0.000001 s).
Setup
Place the following 2 lines in the init2 function. If function init2 does not exist, create it, place this code and run.
Create new function, name it outq. Here is the code:
How to use
Example1
How much time runs code that consists of two lines line1 and line2?
In Output you will see 4 numbers. In this example, valid is only the first. It is number of microseconds between Q &q and Q &qq.
Example2
How to measure several times?
You can measure up to 4 times.
Setup
Place the following 2 lines in the init2 function. If function init2 does not exist, create it, place this code and run.
Create new function, name it outq. Here is the code:
double d; long l
if(!QueryPerformanceFrequency(&l)) ret
d=1000000.0/l
int i(qq-q*d) ii(qqq-qq*d) iii(qqqq-qqq*d) iiii(qqqqq-qqqq*d)
out "%i %i %i %i" i ii iii iiii
ret i
How to use
Example1
How much time runs code that consists of two lines line1 and line2?
Q &q ;;take time 1
line1
line2
Q &qq ;;take time 2
outq ;;output time difference between time 1 and time 2
In Output you will see 4 numbers. In this example, valid is only the first. It is number of microseconds between Q &q and Q &qq.
Example2
How to measure several times?
You can measure up to 4 times.