Solved

How to check the time of procedure execution?

Posted on 2001-07-27
5
201 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 167
Delphi XE10 Round Image 2 162
Tviruailstringtree sort multi columns on header click 1 77
Multi-layered image in FireMonkey 9 49
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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