Measure Performance with Macros

TastyWheat

Registered User.
Local time
Today, 13:11
Joined
Dec 14, 2005
Messages
125
Lately I've been using macros to test the performance of my queries and forms. I guess you could do the same thing with a function, but this seems easier to use. To test the performance of a query you'd make a macro like this:
  • RunCode
  • OpenQuery
  • RunCode
  • Close
Both of the 'RunCode' actions call this function:
Code:
Public Function PrintTime() As Byte
    Debug.Print DateTime.Timer
End Function
The 'OpenQuery' action will open the query you want to time and the 'Close' action will close the query. The time stops as soon as the query is completely displayed (though it may look like a blip on the screen). Then you have to go into Visual Basic and look in the immediate window. Subtract these two times to get the time it took to load the query. These timings aren't very accurate, but from a human point-of-view there's no difference between 1.05 and 1.06 seconds.
 
Sorry, what is your question ?

What I normally do is use the tickcount, you get the tickcount, you run your code, you run a gettime procedure to subtract original tickcount from now and that gives you a figure in milliseconds, which I normally multiply by 1000 to display in seconds e.g. "2.372 secs". This is normally displayed as a message box so you know exactly how long a procedure or a calculation took.
For some easy calculations you 'may' have to do the calc 1,000 times (with an overall timer) to get meaningful figures.
 
Last edited:
How do you get tickcount? It's not in my libraries. I haven't seen very many cases where DateTime.Timer wasn't good enough, but I'd much rather have a millisecond-accurate timer.
 

Users who are viewing this thread

Back
Top Bottom