Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timing program execution (in ms) 1

Status
Not open for further replies.

Ruairi

Programmer
May 14, 2000
314
US
I am debugging a program and having problems finding what is slowing it down. The program loops through a file, changes the format, and saves the data to a new file. There are several calls to my other dll's in this process. THe problem is that i'm trying to find out how long a call is taking to execute. I have been using code like this
Code:
StartTime = Time 
SomeDLL.AMethod Var1, Var2, Var3 
EndTime = Time 
Print #77, "Calling SomeDLL.AMethod " & DateDiff("s", StartTime, EndTime) & " seconds "
the problem is in the resolution. This method obviously only has 1 second resolution so what i end up with is thousands of lines that all say 0 seconds. I need to know which calls are taking .975 seconds and which are taking .001 seconds. Does anyone have a simple way they do this? I just need this for debugging so i dont want to spend a long time figuring out API calls to do this. Thanks for any help. Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
Ruairi,
Why don't you use the timer control? It is a stop gap and would help you measure time in milliseconds. You will need to start it and end it at the required positions and lock the time somehow. I guess you know what I mean.

Hope this helps.
 
I thought about doing it that way but it seems like it will be kinda messy. I guess maybe i'll have to do it that way. Thanks Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
I thought about doing it that way but it seems like it will be kinda messy. I guess maybe i'll have to do it that way. Thanks for your input. Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
Yep, this is messy but it is a easy way out. Or else, you can use Win API calls. But u will need to spend more time on it and watch out for crashes. But it will definitely give you more details.
 
If anyone has been interested in this thread I couldn't get the timer to work but the API call is dirt simple to do this.
Code:
Public Declare Function GetTickCount Lib "kernel32" () As Long

starrtime = GetTickCount 
'do the operations to be timed 
endtime = GetTickCount 
Print #1, "Elapsed time " & endtime - starttime & " ms"
Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top