Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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!
Reply With Quote
  #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.")
Reply With Quote
  #3 (permalink)  
Old February 25th, 2004, 04:35 PM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #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
Reply With Quote
  #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.
Reply With Quote
  #6 (permalink)  
Old February 25th, 2004, 05:18 PM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #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.
Reply With Quote
  #8 (permalink)  
Old February 25th, 2004, 05:49 PM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.