ASP Page Access Timer

Classic ASP Comments Off on ASP Page Access Timer

If you want to know how long your ASP page takes to load from your server. Here is a two lines of code, which accurately calculates the time taken for a page to load. This tutorial uses the TIMER function of the ASP. The logic is very simple just initiate the timer at the start of the page and save the time in a local variable. Secondly, initiate the timer at the end of the page. Finally, calculate the difference between two times and display it as the page accessed or page processed or page generated time.

‘ Start page
Timer 1
—–
——–
————–
——————
—————————
———————————-
——————————————
Your Page codes here
——————————-
———————————-
‘End Page
Timer 2
Print Timer 2 – Timer 1 seconds

Example :-

<%

Starttime = Timer

do until i=5382343

i=i+1

loop

response.write("The page was generated in : " & (Timer - Starttime) & " seconds.")

%>

Add the

Starttime=Timer ” at the beginning of your ASP page and

Response.Write(“The page was generated in : ” & (Timer – Starttime) & ” seconds.”)

at the end of the ASP Page.

/p



Author

Search

Back to Top