Will you please do the following so we can see how long load times actually are?

Discussion in 'The Help Desk' started by Scott Hamilton Robert E Ron Paul Lee, Oct 29, 2009.

  1. Scott Hamilton Robert E Ron Paul Lee

    Scott Hamilton Robert E Ron Paul Lee Straight Awesome

    Joined:
    Jan 5, 2008
    Messages:
    29,016
    Location:
    TN
    Ratings:
    +14,152
    Code:
    [COLOR=#000000][COLOR=#0000BB]<?php 
    [/COLOR][COLOR=#FF8000]// Get Current Time  
    [/COLOR][COLOR=#0000BB]$mtime [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]microtime[/COLOR][COLOR=#007700](); 
    [/COLOR][COLOR=#FF8000]// Split Seconds and Microseconds 
    [/COLOR][COLOR=#0000BB]$mtime [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]explode [/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]" "[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700]);  
    [/COLOR][COLOR=#FF8000]// Create a single value for start time 
    [/COLOR][COLOR=#0000BB]$mtime [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]] + [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]; 
    [/COLOR][COLOR=#FF8000]// Write Start Time Into A Variable 
    [/COLOR][COLOR=#0000BB]$tstart [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700]; 
    
    [/COLOR][COLOR=#FF8000]// Get current time (Like above) to get end time 
    [/COLOR][COLOR=#0000BB]$mtime [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]microtime[/COLOR][COLOR=#007700]();  
    [/COLOR][COLOR=#0000BB]$mtime [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]explode [/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]" "[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700]); 
    [/COLOR][COLOR=#0000BB]$mtime [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]] + [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]; 
    [/COLOR][COLOR=#FF8000]// Store end time in a variable 
    [/COLOR][COLOR=#0000BB]$tend [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$mtime[/COLOR][COLOR=#007700];  
    [/COLOR][COLOR=#FF8000]// Calculate Difference  
    [/COLOR][COLOR=#0000BB]$totaltime [/COLOR][COLOR=#007700]= ([/COLOR][COLOR=#0000BB]$tend [/COLOR][COLOR=#007700]- [/COLOR][COLOR=#0000BB]$tstart[/COLOR][COLOR=#007700]);  
    [/COLOR][COLOR=#FF8000]// Output the result  
    [/COLOR][COLOR=#0000BB]printf [/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"This page was generated in %f seconds."[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$totaltime[/COLOR][COLOR=#007700]);  
    [/COLOR][COLOR=#0000BB]?>
    I'm curious. :)
    [/COLOR][/COLOR]
  2. Scott Hamilton Robert E Ron Paul Lee

    Scott Hamilton Robert E Ron Paul Lee Straight Awesome

    Joined:
    Jan 5, 2008
    Messages:
    29,016
    Location:
    TN
    Ratings:
    +14,152
    Yes? No? Maybe? In discussion?
  3. Darkening

    Darkening Guest

    Ratings:
    +0
    How about no, they really don't need to be adding new code to the board.
  4. Scott Hamilton Robert E Ron Paul Lee

    Scott Hamilton Robert E Ron Paul Lee Straight Awesome

    Joined:
    Jan 5, 2008
    Messages:
    29,016
    Location:
    TN
    Ratings:
    +14,152
    :rolleyes:

    This would give something concrete for people to post when they say the "board takes forever to load."
  5. Darkening

    Darkening Guest

    Ratings:
    +0
    Board takes forever to load when ever they add something you came up with.
  6. Lanzman

    Lanzman Vast, Cool and Unsympathetic Formerly Important

    Joined:
    Mar 27, 2004
    Messages:
    35,186
    Location:
    Someplace high and cold
    Ratings:
    +36,694
    Behave. :nono:

    Apostle, I was away all weekend. I'll have the guys look at this and see what they think.
  7. Scott Hamilton Robert E Ron Paul Lee

    Scott Hamilton Robert E Ron Paul Lee Straight Awesome

    Joined:
    Jan 5, 2008
    Messages:
    29,016
    Location:
    TN
    Ratings:
    +14,152
    Thanks Lanz. The script of fairly common.

    I have it on my main webpage (read: My LIVING) and just remove the # from in front of the php when I want to see what the load times are.

    It recently helped me diagnose a major problem. :)