I have an app that logs the execution time of all DataWindow retrieves in a table. I can then run a report that tells me which ones are slow. The base DataWindow object captures the start time in the retrievestart event and the retrieveend event inserts a row into a table with the DataWindow name datetime and elapsed time. I use the QueryPerformanceCounter Win API function to get sub-second timing.
Something like this:
External Functions:
Function boolean QueryPerformanceFrequency(Ref Double lpFrequency) Library "kernel32.dll"
Function boolean QueryPerformanceCounter(Ref Double lpPerformanceCount) Library "kernel32.dll"
Instance variables:
Double idbl_frequency
Double idbl_start
Constructor event:
QueryPerformanceFrequency(idbl_frequency)
Retrievestart event:
QueryPerformanceCounter(idbl_start)
Retrieveend event:
Double ldbl_stop
Dec{6} ldec_elapsed
QueryPerformanceCounter(ldbl_stop)
ldec_elapsed = (ldbl_stop - idbl_start) / idbl_frequency
INSERT INTO RETRIEVAL_ACTIVITY_LOG
( DATAWINDOW_NAME, RETRIEVE_DATETIME, ROW_COUNT, ELAPSED_TIME )
VALUES ( :this.DataObject, getdate(), :rowcount, :ldec_elapsed );