p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Page Loaded in Seconds Scripts (http://p2p.wrox.com/showthread.php?t=9775)

hcweb February 25th, 2004 02:41 PM

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!

planoie February 25th, 2004 04:15 PM

nStartTime = Timer

'Do stuff on the page

nElapsedTime = Timer - nStartTime

Response.Write("Page generated in " & nElapsedTime*1000 & " milliseconds.")

Imar February 25th, 2004 04:35 PM

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.

hcweb February 25th, 2004 04:53 PM

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

planoie February 25th, 2004 05:00 PM

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.

Imar February 25th, 2004 05:18 PM

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.

planoie February 25th, 2004 05:44 PM

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.

Imar February 25th, 2004 05:49 PM

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.

planoie February 25th, 2004 09:58 PM

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.


All times are GMT -4. The time now is 09:08 PM.

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