long perf
Returns the number of microseconds since Windows startup. Useful to measure the time that is needed to execute various commands.
When high precision is not necessary, you can use GetTickCount instead. It returns the number of milliseconds, with about 10 ms precision.
When measuring the time difference, it is a good idea to repeat it several times. It is because your thread is running not alone, and during the measure time it may be interrupted to give time to other programs and threads that need it. For example, when you move the mouse, OS needs some time to move and repaint the mouse pointer.
Note: Depending on computer speed, this function itself may get 1 or several microseconds.
Note: The type of the return value is long, not int, and therefore this function should be assigned to a long variable. Also, be careful when displaying the results formatted: either at first assign the difference to an int variable, or in the format-string use %I64i instead of %i.
measure how long runs code long t1=perf ;;get time before int i j for i 0 1000 j=5 long t2=perf ;;get time after out t2-t1 ;;display the difference