Solved

How to check the time of procedure execution?

Posted on 2001-07-27
5
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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