A high-precision timer that allows you to measure the time spent on performing any operations. The timer is more than 1 microsecond accurate.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
var countFreq, tmrStart, tmrStop: TLargeInteger; ... var sec: string; begin startTimer(); // --- do something sec:= stopTimer(); ShowMessage('The operation took: ' + sec + ' sec.'); end; |
Options
No
Result
The number of seconds since the timer started.
1 2 3 4 5 6 7 8 9 10 11 |
function startTimer(): Boolean; begin QueryPerformanceFrequency(countFreq); QueryPerformanceCounter(tmrStart); end; function stopTimer(): string; begin QueryPerformanceCounter(tmrStop); Result:= FormatFloat('0.000000', (tmrStop - tmrStart)/countFreq); end; |