Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q5819 How can I time how long it takes my script to run?

You are here: irt.org | FAQ | ASP | Q5819 [ previous next ]

Paste your ASP code into the code example below. Gives the answer in milliseconds.

<script language=jscript runat=server>
function y2k(number) { return (number < 1000) ? number + 1900 :
number; }
function milliDif() {
var d = new Date();
return Date.UTC(y2k(d.getYear()),d.getMonth(),d.getDate(),d.getHours(),
d.getMinutes(),d.getSeconds(), d.getMilliseconds())
}
</script>

<%

' PLACE BEFORE THE CODE YOU WANT TO TIME
timeThen =  milliDif()

' *************
' YOUR ASP HERE
' *************

' PLACE IMMEDIATELY AFTER THE PROCESS FINISHES
timeNow = milliDif()
response.write "<br>Process time in ms: " &  timeNow-timeThen

%>

©2018 Martin Webb