Monitoring page load speeds.

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


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

  2. 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. no it doesn’t work.

    Fatal error: Class ‘mosProfiler’ not found in P:Xampphtdocsjoomlatemplates……index.php on line 10