 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 25th, 2004, 02:41 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Page Loaded in Seconds Scripts
Hey everyone.
I'm looking to add a "This page loaded in x amount of time" script on a particular portion of my site. However, I'm unfamiliar with what is needed to display this, what component(s) are used, or even what the proper name is. Can someone point me in the right direction for some information?
Thanks!
|
|

February 25th, 2004, 04:15 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
nStartTime = Timer
'Do stuff on the page
nElapsedTime = Timer - nStartTime
Response.Write("Page generated in " & nElapsedTime*1000 & " milliseconds.")
|
|

February 25th, 2004, 04:35 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
A Timer? Hmmmm, isn't that one of those cool classes you modern ASP.NET guys have available out-of-the-box?
Us poor "classic ASP" souls have to resort to old components, unfortunately. For example, the one located here: http://www.alphasierrapapa.com/IisDe.../profiler2.zip
To read an article about this control and see a live demo, check here: http://www.4guysfromrolla.com/webtech/122700-1.shtml
Cheers,
"Classic ASP" Imar ;)
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

February 25th, 2004, 04:53 PM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ASP.net? Is that one of those new fangled gadgets?
:o)
Thanks for the response guys. This will give me something to go with!
Chris
|
|

February 25th, 2004, 05:00 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
VBScript Timer() function returns you the current number of seconds since midnight. I use it all the time in my ASP scripts for really simple "this page loaded in ..." code.
In fact, the Snitz forums uses it too...
Code:
function StopTimer(x)
EndTime = Timer
'Watch for the midnight wraparound...
if EndTime < StopWatch(x) then
EndTime = EndTime + (86400)
end if
StopTimer = EndTime - StopWatch(x)
end function
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

February 25th, 2004, 05:18 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Oooops. My bad. Thought you were referring to the Timer class in .NET.
Wasn't really aware of the Timer function, and didn't know it was so easy to use....
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

February 25th, 2004, 05:44 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Oddly enough, I have yet to find an equivalent function in .NET because of the Timer class. Had to use regular timestamps and more complicated math.
|
|

February 25th, 2004, 05:49 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Aren't there special Performance Counter classes that do all the hard work?
I can't recall their names (haven't really worked with them), but I believe there is something that already does this for you.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

February 25th, 2004, 09:58 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
There may be, I'm not familiar with any in VBScript. I think that is really the limitation, VBScript doesn't have a whole lot of that type of advanced stuff from what I have found.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|
 |