SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    amount of seconds a certain event takes

    I would like to to deisplay how long a page loads in two formats

    page loaded in .49 secs

    and
    page loaded in 230 millisecs

    how would I do this in C#?

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,625
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    If you are trying to do this for debugging/scalability testing, ASP.NET's builtin trace is what you want.

    To display this stuff, probably the easiest way would be to hook into the trace events anyhow.

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when you do a google search it says page loaded in .17 secs for example. How would I do this for my page?

  4. #4
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does anybody know

  5. #5
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Clogland
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by luke101
    when you do a google search it says page loaded in .17 secs for example. How would I do this for my page?
    It actually means how long it took to generate the page. You could do this quite easily yourself:

    - get the time, store it in a variable
    - do your stuff
    - get the time again and calculate the difference

    I don't do C# maybe someone else can help you with that

  6. #6
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,625
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    ^^^That is a good snyopsis, though getting the correct time is actually a bit trickier. Main issue is exactly when to start and stop the clock.

    Real question is what you want to measure: the whole lifetime of the request, the time it takes the data layer to return the data or something else.


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
  •