SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Froot r gewd SubKamran's Avatar
    Join Date
    May 2002
    Location
    North Star State
    Posts
    597
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Page generated in 'x' seconds, 'x' queries executed

    How can I add that to the bottom of my pages in ASP...? I know u can do it in PHP, so how can I do that in ASP? (I'm using mySQL)
    "Sometimes little is more."
    Kamran A
    Web Dev/Designer
    Keyboard not found: Please Press F1 to Continue

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Re: Page generated in 'x' seconds, 'x' queries executed

    Originally posted by SubKamran
    How can I add that to the bottom of my pages in ASP...? I know u can do it in PHP, so how can I do that in ASP? (I'm using mySQL)
    There's no built-in method to do this in ASP like there is in PHP so you'll have to fake it. It would probably go something like this:

    [vbs]
    dim count, query(50), date1, date2, difference

    'Get current time pre-queries
    date1 = date(now)

    'loop thru all queries
    for x = 0 to [number of queries]
    query(x)= [SQL Query Here]
    next

    'Get current time post-queries
    date2 = date(now)

    'Get time to execute
    difference = DateDiff("s", date1, date2)

    'count of queries
    count = x

    'output to browser
    response.write("Page generated in " & difference & " seconds, " & count & " queries executed.")
    [/vbs]

    That should help! The timing is for query execution but if you put the date1 and date2 variables at the beginning and end of what you want to time, respectively, you should get the result you want.

    --Vinnie

  3. #3
    SitePoint Evangelist worksdev's Avatar
    Join Date
    Mar 2002
    Location
    Central, PA - originally from Monterey, CA
    Posts
    497
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a discussion on Script timing found at 4guysfromrolla:
    http://www.4guysfromrolla.com/webtech/122799-1.shtml

    One article linked to it suggested the date difference method, was not as accurate (something to do with the level of measurement).

    From what I gathered when I researched this before, there is little that can be done to get very accurate times except for longer executing scripts or running multiple iterations.

    Best Regards.
    worksdev

  4. #4
    SitePoint Addict
    Join Date
    Feb 2000
    Location
    Minnesota
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use this code that I found somewhere

    Code:
    <%
    dtBegin = timer
    
    (code here)
    
    dtEnd = timer
    
    sProcessingTime = formatnumber(dtEnd - dtBegin, 2)
    %>
    Keomed.com Webmaster
    www.keomed.com

  5. #5
    Froot r gewd SubKamran's Avatar
    Join Date
    May 2002
    Location
    North Star State
    Posts
    597
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nah...it's OK, I won't go through the trouble...

    Btw, Hideki, the weather here (MN) sux doesn't it? One day it's 90 degrees, and the next it's a storm! GRRR!
    "Sometimes little is more."
    Kamran A
    Web Dev/Designer
    Keyboard not found: Please Press F1 to Continue

  6. #6
    SitePoint Addict
    Join Date
    Feb 2000
    Location
    Minnesota
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No Sh$t....and before you know it the leaves are falling and it's winter!

    Gonna go water skiing now. Hopefully it won't rain like it did the last 3 days. Where's newsbyteens based from?

    The script above is very simple. Just stick it at the very top and very bottom of your page.
    Keomed.com Webmaster
    www.keomed.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •