0

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?)

0

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' );
  • 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
1

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.

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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