Solved

How to check the time of procedure execution?

Posted on 2001-07-27
5
199 Views
Last Modified: 2010-04-06
How can I check the amount of time taken by a procedure. I look for a timer which could count the time during procedure execution. Maybe somebody have an assembler code to system timer interrupt, cause it could solve this problem.
0
Comment
Question by:Skorup
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6326095
start := GetTickCount;
Call_procedure;
ende := GetTickCount;
timeusage := ende-start; //in milliseconds
0
 

Accepted Solution

by:
d32coder earned 50 total points
ID: 6326159
using the formatdatetime() procedure at the start and end of the procedure can give you the elapsed time.

uses DateUtils,


procedure MyCode(sender: TObject);
var X,Y: TTime; Z: Integer;
begin
 x := Time;


 your code here



 y := Time;
 a := SecondsBetween(x,y);
 Label1.Caption := IntToStr(a) + ' Seconds elapsed.';
end;
 

Note: There is also a MilliSecondsBetween, used the same way;


Good Luck
Don
0
 

Expert Comment

by:d32coder
ID: 6326164
Oops.

Forget the FormatDateTime reference in the previous comment.
0
 

Expert Comment

by:d32coder
ID: 6326168
Crap  :)

Change Z: Integer to A: Integer;
in the var line.  

I need more sleep.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6335187
:-(
not a good choice,
gettickcount is much more correct,
because it has not so an overhead as the time-function
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question