Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old February 25th, 2004, 02:41 PM
Authorized User
 
Join Date: Jun 2003
Location: Gulfport, Ms, USA.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default 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!
  #2 (permalink)  
Old February 25th, 2004, 04:15 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

nStartTime = Timer

'Do stuff on the page

nElapsedTime = Timer - nStartTime

Response.Write("Page generated in " & nElapsedTime*1000 & " milliseconds.")
  #3 (permalink)  
Old February 25th, 2004, 04:35 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
  #4 (permalink)  
Old February 25th, 2004, 04:53 PM
Authorized User
 
Join Date: Jun 2003
Location: Gulfport, Ms, USA.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

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
  #5 (permalink)  
Old February 25th, 2004, 05:00 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
  #6 (permalink)  
Old February 25th, 2004, 05:18 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
  #7 (permalink)  
Old February 25th, 2004, 05:44 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
  #8 (permalink)  
Old February 25th, 2004, 05:49 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
  #9 (permalink)  
Old February 25th, 2004, 09:58 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help - Synchronizing Page Loaded with Each Hit kylex Javascript How-To 1 February 20th, 2008 01:48 AM
how to let the page holding for a few seconds walgr2k ASP.NET 2.0 Basics 1 May 19th, 2006 01:55 PM
check if page is loaded darkhalf Javascript 1 October 4th, 2005 05:26 AM
how to check if page is already loaded? phpworker Javascript How-To 0 July 31st, 2005 11:49 AM
Converting Seconds into Nano seconds and viceversa chandu80 General .NET 0 June 4th, 2005 01:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.