Monitoring page load speeds.

Written by on November 9, 2009 in Development tips - 3 Comments

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.

Open your index.php file, and:

Insert after <head>


<?php function getmicrotime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec); }
$starttime = getmicrotime(); ?>

Insert before </body>


<?php $endtime = getmicrotime();
echo"This page was generated in
", number_format($endtime-$starttime, 4, ",", "."), " seconds."; ?>

About the Author

Matthew King is the excessively caffeinated head of customer service and system administrator for JoomlaJunkie. He loves paintball and dry humor. Matt also sells web hosting and does website design at ColumbusGEEK.com. He is based in Columbus, Ohio (USA).

3 Comments on "Monitoring page load speeds."

  1. Forrest January 14, 2010 at 5:37 pm ·

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

  2. matt January 15, 2010 at 3:39 pm ·

    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 February 8, 2010 at 7:20 pm ·

    no it doesn’t work.

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

    huh…

Comments are now closed for this article.