John Colby
jcolby at colbyconsulting.com
Wed Jun 25 12:04:56 CDT 2003
Rocky,
IINM, the load even of the main form happens AFTER all of the load events of
all of the subforms. One way to do this would be to dim an instance of the
timer class globally <gasp> and have the switchboard click call
mclsTimer.StartTimer.
Then have the main form's load event call the MsgBox mclsTimer.EndTimer
& " ms total elapsed time - Hit any key to continue", , "TIME FORM LOAD"
Do this with an otherwise identical JIT form and a non JIT form. The
difference in times would be the load time of the subforms.
When I was timing form loading I actually set up a loop that opened the
form, then closed it again, repeating that X times. This evened out the
effects of caching etc. In that case, simply instantiate the class before
entering the loop, then display the results after exiting the loop.
I can modify your demo if you want to send it to me.
John W. Colby
www.colbyconsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin -
Beach Access Software
Sent: Wednesday, June 25, 2003 11:37 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Time in milliseconds
John:
Will it work across forms?
I'm demonstrating your Just-In-Time forms at the AUGSD tonight and since
it's a single user box the difference in opening time is hard to see, even
though it's a factor of 2-4.
I think I need to start my timing from the Main Menu Click event that
opens the form with the sub-forms in it, as some of the processing of
loading the sub-form's recordsets goes on even before the called form's
OnOpen event.
Best,
Rocky
----- Original Message -----
From: John Colby
To: accessd at databaseadvisors.com
Sent: Wednesday, June 25, 2003 6:47 AM
Subject: RE: [AccessD] Time in milliseconds
Rocky,
Here is the class I use for timing things such as the opening of forms
and such, with a timer test function you can place in a module to play
around with the class. Dead simple to use.
The nice thing about using a class is that you can have as many
instances as you need timing various stuff since the variable tracking
elapsed time is private to the class instance.
Option Compare Database
Option Explicit
Dim mclsTimer As clsTimer
Function TestTimer()
Set mclsTimer = New clsTimer
MsgBox "Hit any key to continue", , "TIMER TEST 1"
MsgBox mclsTimer.EndTimer & " ms elapsed time - Hit any key to
continue", , "TIMER TEST 1"
MsgBox mclsTimer.EndTimer & " ms total elapsed time - Hit any key to
continue", , "TIMER TEST 2"
mclsTimer.StartTimer
MsgBox "Hit any key to continue", , "TIMER TEST 3"
MsgBox mclsTimer.EndTimer() & " ms elapsed time", , "TIMER TEST3"
Set mclsTimer = Nothing
End Function
Option Compare Database
Option Explicit
'.===============================================================
'.Copyright 2001 Colby Consulting. All rights reserved.
'.E-mail : jcolby at colbyconsulting.com
'.===============================================================
' DO NOT DELETE THE COMMENTS ABOVE. All other comments in this module
' may be deleted from production code, but lines above must remain.
'---------------------------------------------------------------------
'.Description : Implements the instantiated class for: clsTimer
'.
'.Written By : John W. Colby
'.Date Created : 05/28/2001
' Rev. History :
'
' Comments :
'---------------------------------------------------------------------
'.
' ADDITIONAL NOTES:
'
'---------------------------------------------------------------------
'
' INSTRUCTIONS:
'---------------------------------------------------------------------
'.
'THESE CONSTANTS AND VARIABLES ARE USED INTERNALLY TO THE CLASS
'*+ Class constant declaration
'*- Class constants declaration
'*+ Class variables declarations
'*- Class variables declarations
'THESE CONSTANTS AND VARIABLES ARE USED BY THE CLASS TO
'IMPLEMENT CLASS FUNCTIONALITY
Private Declare Function apiGetTime Lib "winmm.dll" _
Alias "timeGetTime" () As Long
'*+ custom constants declaration
'*- Custom constants declaration
'*+ custom variables declarations
Dim lngStartTime As Long
'*- custom variables declarations
'THESE FUNCTIONS / SUBS ARE USED INTERNALLY TO THE CLASS
'*+ Private Init/Terminate Interface
Private Sub Class_Initialize()
StartTimer
End Sub
'*- Public Init/Terminate interface
'*- Parent/Child links interface
'THESE FUNCTIONS / SUBS ARE USED TO IMPLEMENT CLASS FUNCTIONALITY
'*+Class function / sub declaration
Function EndTimer() As Long
EndTimer = apiGetTime() - lngStartTime
End Function
Sub StartTimer()
lngStartTime = apiGetTime()
End Sub
Function RawTime() As Long
RawTime = apiGetTime()
End Function
'*-Class function / sub declaration
John W. Colby
www.colbyconsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin -
Beach Access Software
Sent: Tuesday, June 24, 2003 12:08 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Time in milliseconds
Dear List:
Is it possible to access/store/display the time in increments smaller
than seconds. I need to time something in fractions of a second.
MTIA
Rocky
----------------------------------------------------------------------------
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030625/9bc09355/attachment-0001.html>