Mega Code Archive

 
Categories / Delphi / Examples
 

Timingfunctioncalls

TIMING FUNCTION CALLS Note that in order to use the timeGetTime (API) call, the MMSystem unit must be in the Uses clause... ********************************************************* var startTime: Integer; endTime: Integer; funcCallTime: Integer; begin startTime := timeGetTime; //put the function or block of code you want to time here cText := GetClipboardText; endTime := timeGetTime; funcCallTime := (endTime - startTime); tempString := 'GetClipboardText takes ' + IntToStr(funcCallTime) + ' milliseconds to execute.'; Application.MessageBox(PChar(tempString), ' Programmers Debug Window', mb_OK); end;