High precision timer function. Measures the time between two calls in microseconds.
Used for performance testing of functions and instructions.
Time since the last timer() call in microseconds (1/1000000 sec), var (timer) or double (dtimer).
- This instruction uses the Pentium high-precision performance counter.
- The returned value has a precision of a few nanoseconds, depending
on the processor clock rate.
Due to the limited var range, the timer() function can only measure time within one frame. For time periods that span several frames, the dtimer() function that returns a double value, or the total_ticks counter can be used.
time_elapsed = timer(); // processor time used for the c_trace call
time_step, total_ticks, wait