Solved

How to check the time of procedure execution?

Posted on 2001-07-27
5
198 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
Comment Utility
start := GetTickCount;
Call_procedure;
ende := GetTickCount;
timeusage := ende-start; //in milliseconds
0
 

Accepted Solution

by:
d32coder earned 50 total points
Comment Utility
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
Comment Utility
Oops.

Forget the FormatDateTime reference in the previous comment.
0
 

Expert Comment

by:d32coder
Comment Utility
Crap  :)

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

I need more sleep.
0
 
LVL 27

Expert Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now