' get timer before task begins: starttime = Timer() ' do some task, e.g.: Do While z < 350000 z = z + 1 Loop ' get timer after task completes: endtime = Timer() ' display results: Response.Write "The task completed in " & endtime-starttime & " s" Response.Write " (" & (endtime-starttime)*1000 & " milliseconds)."
' set number of seconds: numSeconds = 5 ' set counter: counter = 0 ' get starttime: starttime = now() ' set endtime to some time more than numSeconds in the future: endtime = dateadd("n", numseconds + 1, starttime) ' loop until numSeconds have passed, resetting endtime each loop: Do Until DateDiff("s", starttime, endtime) = numSeconds endtime = Now() counter = counter + 1 Loop ' display results: Response.Write "In " & numSeconds & " seconds, the task completed " & counter & " times." Response.Write "<br>(Average time per loop: " Response.Write FormatNumber(numSeconds*1000/counter,0,-1,0,-1) & " milliseconds.)"
Source: http://classicasp.aspfaq.com/general/how-do-i-time-my-asp-code.html
Last Updated on October 26, 2015