I've just written a very "trivial" monitoring tool and it's providing
bizarre results. The code doesn't error as such, I think it may be the
concept that's wrong.
The tool is in two parts. The first is an ASP web page on a remote server
and the second is a VB6 application running locally which calls the ASP
page.
When called, the ASP web page loads the current time into a variable with
double point precision [dStart = CDbl(TImer)], does some work [connecting
through to a database and iterating through the resultant recordset] and
then records the finish time, also as a double. It then returns an XML
string that contains these start and end values.
In a similar vein, the VB6 application notes the start time, calls this ASP
page and then notes the end time. It calls the ASP page by creating a
MSXML2.XMLHTTP object and doing a SYNCHRONOUS connection (asynch=False).
The responseText gets loaded into a MSXML2.DOMDOCUMENT and the ASP
processing times are extracted using XPath expressions.
The VB6 application then calculates the times. So, I effectively have four
times:
startVBRequest, startASPProcessing, endASPProcessing and endVBRequest.
To my mind:
+ the processing time on the remote server is (endASPProcessing -
startASPProcessing)
+ the total time is (endVBRequest - startVBRequest)
+ the network-hop time is ((endVBRequest - startVBRequest) -
(endASPProcessing - startASPProcessing))
Because these are using time-differences, the local clock values of the
machines should be irrelevant.
My problem is that whilst I get finite values for the ASP processing time,
the total time values are 0, making the network time negative.
I don't like to think I'm breaking the laws of physics here, so there must a
better way of measuring elapsed times? By the way - although the monitoring
tool is currently in VB6, I'm soon going to make it ASP too, so don't want
to use any controls (OCX).
Any advice here?
Thanks
Griff