发新话题
打印

如何获得asp页面的载入时间(转)

如何获得asp页面的载入时间(转)

如何获得ASP页面的载入时间


<!--- How can I time the execution speed of my ASP pages to the millisecond? --->

Doing this is easy with a simple server-side javascript function:


<script language=jscript runat=server>
function GetTime()
{
   var d = new Date();
   return d.getTime();
}
</script>




The getTime() method of the Date object in JScript returns the number of millisecond since Jan 1st, 1970. Therefore all you have to do it take a reading immediately before and after the process you are wanting to time. The following is an example, given that the above code it in GetTime.ASP:



   Dim StartTime, EndTime

   StartTime = GetTime()
   ' Do some stuff here
   EndTime = GetTime()

   Response.Write "The process took: "

TOP

发新话题