getTickCount() should give you a timestamp in milliseconds
HTH On 10/08/05, Karl Simanonok <[EMAIL PROTECTED]> wrote: > I'd like to be able to measure the response times of thousands of various > URLs I have in a database. This is one way: > > <CFOUTPUT QUERY="GetSites"> > > <CFSET TimeHack1 = TimeFormat(Now(), 'hh:mm:ssTT')> > > <CFHTTP URL="#GetSites.URL#" > METHOD="GET" > resolveURL="1" > throwOnError="YES"> > </CFHTTP> > > <CFSET TimeHack2 = TimeFormat(Now(), 'hh:mm:ssTT')> > > <CFSET TimeDiff = DateDiff("s", TimeHack1, TimeHack2) * 1000> > > <H1>Ping time: #TimeDiff# Milliseconds!</H1> > > </CFOUTPUT> > > The PROBLEM with this method is that the ColdFusion time functions only > allow resolution to the nearest second, so I get results like 0, 1000, > 2000, 3000 etc., a very crude measurement when what I really want is > response time in milliseconds. > > > Here is another way to to potentially solve the problem, from > http://www.tek-tips.com/viewthread.cfm?qid=1090810&page=3: > > <cfset dir=getdirectoryfrompath(getcurrenttemplatepath())> > > <cfloop from="254" to="200" index="lp" step="-1"> > > <cfset ip="10.1.1.#lp#"> > > <cfset filename="10.1.1.#numberformat(lp,"000")#.txt"> > > <cfexecute name="c:\winnt\system32\ping.exe" arguments="#ip# -n 1" > timeout="5" outputfile="#dir##filename#"></cfexecute> > > <cffile action="READ" file="#dir##filename#" variable="txt"> > > <cfoutput>#ip#</cfoutput> > > <cfif txt contains "Reply from #ip#"> > SUCCESS > <cfelseif txt contains "Request timed out."> > -failed- > <cfelse> > <font color="Red">unknown</font> > </cfif> > </cfloop> > > The PROBLEM with this second method is that it's got to be horribly > inefficient to repeatedly call Ping.exe with CFEXECUTE (and wait for four > replies), write a file, then read the file. On top of it the output has to > be parsed up to get the final number of milliseconds that I really > want. While this method could probably be made considerably more efficient > by skipping the file-writing and file-reading steps and just parsing the > output from CFEXECUTE, it's still ugly and kludgy to repeatedly call > Ping.exe this way, I'd sooner just get my results to the nearest second > with the first method. > > 1) I'd very much like to be able to use CF by itself if possible; is there > any known way to use CF to get the time difference between two time hacks > in milliseconds? > > 2) Secondly, because CF is limited in the number of simultaneous threads it > can handle (I'm using CF 5 although I could use MX 6 if I really had to), > what happens if thousands of CFHTTP requests are made this way very > quickly? Does CF just stop and wait until there are threads available or > could so many CFHTTP requests lock up the server this app would be running > on? I suppose I could throttle down the request rate if I had to, there > isn't any reason why thousands of CFHTTP requests have to be made all in > one batch. So I guess this question boils down to: what would be the > maximum number of CFHTTP requests that I should burden the server with at > any one time? It's a CrystalTech dedicated server, a 1.8 GHz single Intel > CPU machine running Windows 2003 Server and CF 5.0 with about half a gig of > RAM, and it can be devoted to this task if need be, so interference with > other applications isn't a factor. > > 3) Finally, CFHTTP if successful will return all the code from the URL > called, unlike Ping.exe. I like this fact because it will give me a truer > response time for each URL in my database, but all I actually need is the > response time in milliseconds. Is all the data returned going to fill up > RAM on the server or worse go to disk cache, or can I somehow tell CF to > discard it immediately? > > Regards, > > Karl Simanonok > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.338 / Virus Database: 267.10.5/67 - Release Date: 8/9/05 > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:214315 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54