DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Measure execution time in your program

Simply call

  • StartClock before and
  • StopClock after
the part of the program you want to clock, as shown in the example:

var { must be global }
   hr, mins, se, s1 : word;
 
 procedure StartClock;
 begin
   GetTime (hr,mins,se,s1);
 end;
 
 procedure StopClock;
 var
   siz : longint;
   hr2, min2, se2  : word;
 begin
   GetTime (hr2, min2, se2, s1);
   siz := se2-se+(min2-mins)*60+(hr2-hr)*60*60;
   ShowMessage (IntToStr(siz) + ' seconds');
 end;
 
 { sample how to use it.. very simple }
 begin
   StartClock;
   for i := 1 to 100 do
     MyProcedure(i);
   StopClock;
 end.
 

Generated 16:02:05 on Mar 27, 2017