Forum Moderators: open
I was wondering if you could help. I have seen it done on many sites and was looking for some simple could. At the bottom of every page on one of my sites I want the sentence:
This page was generated in ... seconds
Where ... is the amount of time the sever took to create the page.
Can anyone help as most of the code I have seen is very complicated.
Chris
Store the value this generates twice - once at the start on the script, once at the end of the script then work out the difference.
<%
Dim fVal(1), ifVal(0) = CSng( Timer )
Response.Write fVal(0) & "<BR>"For i = 1 to 500000
Sqr( iCount )
NextfVal(1) = CSng( Timer )
Response.Write fVal(1) & "<BR>"
%>This script took <%= CSng( fVal(1) - fVal(0) ) %> seconds to execute.
n.b. the "For" loop is simple there to make it do some work and eat some time - you might need to alter the numbers to get it to take more or less time depending on your system speed.
Hope that was simple enough / helps!
- tony
[edited by: Dreamquick at 1:56 pm (utc) on Dec. 20, 2002]