Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm looking to measure how fast my site is processed. Is there any software out there that can do this?

If it depends on the server, is there any way to monitor the speed from my localhost (purely CPU load?)

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I usually use the timer_stop() function via the WordPress 'shutdown' hook, like this:

// Grab the page load time upon WordPress shutdown.
function page_load_time() {

    echo '<p>Page load time: '.timer_stop(0, 5).' seconds.</p>';
}
add_action( 'shutdown', 'page_load_time' );
share|improve this answer
    
So I guess I'm confused based on the above answer. What good is measuring the site load time if it does not wait until all calls to the database are complete? I'm not so much concerned as to how to get the HTML parsed as I am about the database traffic time. –  AlxVallejo Dec 19 '11 at 14:22
1  
The shutdown hook runs after everything has finished loading so is a good place to stop the timer. –  dgwyer Dec 19 '11 at 16:23

Use timer_stop() just before </body>

If you want to see the execution time of each SQL query too, define('SAVEQUERIES', true) in your wp-config, and do a var_dump($GLOBALS['wpdb']->queries) in your footer.

share|improve this answer
    
Might be a stupid question: Since Wp is db driven, does timer_stop() stop the timer after all the calls to the server have been made? –  AlxVallejo Dec 16 '11 at 20:45
    
no, it just computes the time since the timer started. that's why you should use it before the scripts ends... –  onetrickpony Dec 16 '11 at 21:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.