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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer rule 1

Status
Not open for further replies.

lytus

MIS
Jun 17, 2004
48
US
I am trying to see how long it takes for a script to go out to a website and receive a response. I was just wondering if anyone has done anything like that, and how it can be done. Any help or guidance would be greatly appreciated.
Thanks.
 
datStartTime = Now()

'go off and do something
Wscript.Sleep(1000)

datEndTime = Now()
durationSec = DateDiff("s",datStartTime,datEndTime)

Wscript.Echo durationSec
 
I am needing more in the millisecond range. It is going out to web sites, it usually, if working properly, will send back faster than a second.
 
Hello lytus,

Usually timer would suit better for this kind of sub-second monitoring of time elapse. Do something like this for instance.
Code:
surl="[URL unfurl="true"]www.google.com"[/URL]

set oie=createobject("internetexplorer.application")
oie.navigate "about:blank"
do while oie.readystate<>4 : wscript.sleep 50 : loop
dt_start=timer
oie.navigate surl
'sleep gives rise to intrinsic error magin in x milliseconds
do while oie.readystate<>4 : wscript.sleep 10 : loop
dt_end=timer
oie.quit
set oie=nothing
wscript.echo "Loading " & surl & " takes : " & formatnumber(dt_end-dt_start,3) & " sec"
Though this may not be very powerful way to do it, it illustrates the basic. Many variations like using msxmlhttp component or even ping utility can each give data of different aspect of slightly different thing.

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top