Monitoring page load speeds.

Written by Matt on 9 November 2009

Topics: Development tips

One of the most important elements to good website design, is optimization. There is no point developing / designing a work of art site, where no one without a 2mb broadband connection can load it. Here is a nifty trick, taken from HarryB on the Joomla.org forums. It adds a little line at the bottom of your sites page, showing you the load time of each page.
You can then use that to stress test and see which mods are making the site load slowly.

Add just below your tag of your index.php file:

// Start page load timer ...tick tock...
// -----------
$tstart = mosProfiler::getmicrotime();
?>

Add just above your tag (also in the index.php file).

// Display page generation time...
// ---------
$tend = mosProfiler::getmicrotime();
$totaltime = ($tend - $tstart);
printf ("Page was generated in %f seconds", $totaltime);
?>

Get notified about new tips & tricks for Joomla:

RSS

Click here to subscribe via RSS feed


subscribe

Click here to receive updates via email

3 Comments For This Post I'd Love to Hear Yours!

  1. Forrest Says:

    Eh, where’s the code? No sample code is shown above.

  2. matt Says:

    Sorry about that Forrest. We changed the styling of how our code looks in articles. This post was referencing the old way. Should be all good now.

  3. nope Says:

    no it doesn’t work.

    Fatal error: Class ‘mosProfiler’ not found in P:\Xampp\htdocs\joomla\templates\……\index.php on line 10

    huh…

Leave a Comment Here's Your Chance to Be Heard!

CommentLuv Enabled

Subscribe without commenting