Page 1 of 1

How to use TProfiler ???

PostPosted: December 7th, 2007, 6:10 pm
by $^$
Hi all....
Does anyone know how to use it???
Because i don't get it how to use it...... :(

I want to calculate my execution time......


Thx

PostPosted: December 7th, 2007, 8:17 pm
by Kambiz
Suppose you want to measure execution time of a procedure named Test, and you have put a TProfiler on the form and named it Profiler.

Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
  Profiler['Test'].Start;

  Test;

  Profiler['Test'].Stop;
end;


Whenever you need, you can use AsText property of the timer to display the result on the screen.

Code: Select all
Memo1.Lines.Add(Profiler['Test'].AsText[tiAll]);


When execution of your application is finished, you can find all timing results on Events Log of Delphi. From Delphi's menu select [View -> Debug Windows -> Event Log] or press Alt+Ctrl+V.

PostPosted: December 8th, 2007, 3:31 pm
by $^$
Wow.... it's a great and simple component to use it...... =D>

Btw the units in ms.... if i use another computer and run the program..... if the result same ???? or it depends on processor frequency ???

Thx

Regard,
-$^$-

PostPosted: December 8th, 2007, 8:02 pm
by Kambiz
It depends on the processor.

In other hand, because Windows is a multi-tasking OS, in the same machine you may get different results. Because of that you have to run the test several times and use the average time.