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 instead use GetTickCount (~10 ms precision) or timeGetTime (2 ms precision). They return the number of milliseconds since Windows startup.
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 the mouse pointer.
Note: Depending on computer speed, perf itself may get 1 or several microseconds.
Note: The type of the return value is long (64-bit), not int (32-bit). 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